[TASK] Pootle table pootle_store_store should be migrated 81/41481/2
authorXavier Perseguers <xavier@typo3.org>
Thu, 16 Jul 2015 15:37:34 +0000 (17:37 +0200)
committerXavier Perseguers <xavier@typo3.org>
Thu, 16 Jul 2015 15:40:03 +0000 (17:40 +0200)
Change-Id: I24163a96ba530a9bb575529fb8fed10c3eb300df
Reviewed-on: http://review.typo3.org/41481
Reviewed-by: Xavier Perseguers <xavier@typo3.org>
Tested-by: Xavier Perseguers <xavier@typo3.org>
README.rst
typo3/files/scripts/bin/migration/1-migrate-typo3-xliff [new file with mode: 0755]
typo3/files/scripts/bin/migration/2-project-renamer [new file with mode: 0755]
typo3/files/scripts/bin/migration/migrate-typo3-xliff [deleted file]
typo3/files/scripts/bin/migration/project-renamer [deleted file]

index e1469b7..982ad02 100644 (file)
@@ -68,8 +68,8 @@ Migrating data from production
 - Migrate XLIFF to global space with unique id::
 
       $ sudo su - pootle
-         $ ~/scripts/bin/migration/migrate-typo3-xliff
-         $ ~/scripts/bin/migration/project-renamer
+         $ ~/scripts/bin/migration/1-migrate-typo3-xliff
+         $ ~/scripts/bin/migration/2-project-renamer
 
 - Update your password to be "password"::
 
diff --git a/typo3/files/scripts/bin/migration/1-migrate-typo3-xliff b/typo3/files/scripts/bin/migration/1-migrate-typo3-xliff
new file mode 100755 (executable)
index 0000000..9ff5244
--- /dev/null
@@ -0,0 +1,62 @@
+#!/usr/bin/env bash
+
+. /home/pootle/scripts/etc/pootle.conf
+. /home/pootle/scripts/etc/functions
+
+pushd ${POOTLE_PO} >/dev/null
+
+PROJECTS=$(find . -maxdepth 1 -name TYPO3.TYPO3.core.\* -type d | cut -b3- | sort)
+
+for PROJECT in ${PROJECTS}; do
+       pushd ${PROJECT} >/dev/null
+
+       echo "[INFO]    Migrating ${PROJECT}"
+       pootle-manage sync_stores --overwrite --project=${PROJECT}
+
+       LANGUAGES=$(find . -maxdepth 1 -type d | cut -b3-)
+       for LANGUAGE in ${LANGUAGES}; do
+               pushd ${LANGUAGE} >/dev/null
+               rm -rf .converted
+               mkdir .converted
+
+               FILES=$(find . -name \*.xlf | cut -b3-)
+               for FILE in ${FILES}; do
+                       T3ID=$(xmlstarlet sel -t -m "//xliff/file" -v "@t3:id" ${FILE} 2>/dev/null)
+                       if [ -z "${T3ID}" ]; then
+                               # Legacy file: keep it as-is
+                               continue
+                       fi
+                       TARGET_NAME=.converted/locallang.${T3ID}.xlf
+                       if [ -f ${TARGET_NAME} ]; then
+                               echo "[ERROR]   OOOPS! Duplicate T3ID ${T3ID} with $FILE" >&2
+                               exit 1
+                       fi
+
+                       mysqlpipe "
+                               UPDATE pootle_store_store SET
+                                       file = REPLACE(file, '${FILE}', 'locallang.${T3ID}.xlf'),
+                                       pootle_path = REPLACE(pootle_path, '${FILE}', 'locallang.${T3ID}.xlf'),
+                                       name = 'locallang.${T3ID}.xlf'
+                               WHERE file LIKE '${PROJECT}/${LANGUAGE}/${FILE}'
+                       "
+                       mv ${FILE} ${TARGET_NAME}
+               done
+
+               mv .converted/*.xlf . >/dev/null 2>&1
+               rmdir .converted
+
+               # Remove empty directories
+               find . -type d | sort -r | xargs rmdir >/dev/null 2>&1
+                                       
+               popd >/dev/null
+       done
+
+       echo "[INFO]    Updating Pootle stores for ${PROJECT}"
+       pootle-manage update_stores --project=${PROJECT}
+
+       popd >/dev/null
+done
+
+popd >/dev/null
+
+echo "[INFO]    ====== UPDATE FINISHED ======"
diff --git a/typo3/files/scripts/bin/migration/2-project-renamer b/typo3/files/scripts/bin/migration/2-project-renamer
new file mode 100755 (executable)
index 0000000..5fd1a4b
--- /dev/null
@@ -0,0 +1,42 @@
+#!/usr/bin/env bash
+
+. /home/pootle/scripts/etc/pootle.conf
+. /home/pootle/scripts/etc/functions
+
+echo
+echo "This script will rename TYPO3.TYPO3.* projects into TYPO3.*"
+echo "Press ENTER to continue"
+read
+
+pushd ${POOTLE_PO} >/dev/null
+
+PROJECTS=$(find . -maxdepth 1 -name TYPO3.TYPO3.\* -type d | cut -b3- | sort)
+for PROJECT in ${PROJECTS}; do
+       NEW_NAME=$(echo ${PROJECT} | cut -b7-)
+       echo "[INFO]    Renaming project ${PROJECT}"
+
+       mysqlpipe "
+               UPDATE pootle_app_project SET
+                       code = REPLACE(code, 'TYPO3.TYPO3.', 'TYPO3.'),
+                       fullname = REPLACE(fullname, 'TYPO3.TYPO3.', 'TYPO3.')
+               WHERE code = '${PROJECT}'
+       "
+       mysqlpipe "
+               UPDATE pootle_app_translationproject SET
+                       real_path = REPLACE(real_path, 'TYPO3.TYPO3.', 'TYPO3.'),
+                       pootle_path = REPLACE(pootle_path, 'TYPO3.TYPO3.', 'TYPO3.')
+               WHERE real_path LIKE '${PROJECT}/%'
+       "
+       mysqlpipe "
+               UPDATE pootle_store_store SET
+                       file = REPLACE(file, 'TYPO3.TYPO3.', 'TYPO3.'),
+                       pootle_path = REPLACE(pootle_path, 'TYPO3.TYPO3.', 'TYPO3.')
+               WHERE file LIKE '${PROJECT}/%'
+       "
+
+       mv ${PROJECT} ${NEW_NAME}
+done
+
+popd >/dev/null
+
+echo "[INFO]    ====== UPDATE FINISHED ======"
\ No newline at end of file
diff --git a/typo3/files/scripts/bin/migration/migrate-typo3-xliff b/typo3/files/scripts/bin/migration/migrate-typo3-xliff
deleted file mode 100755 (executable)
index a8450d6..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/env bash
-
-. /home/pootle/scripts/etc/pootle.conf
-
-pushd ${POOTLE_PO} >/dev/null
-
-PROJECTS=$(find . -maxdepth 1 -name TYPO3.TYPO3.core.\* -type d | cut -b3- | sort)
-
-for PROJECT in ${PROJECTS}; do
-       pushd ${PROJECT} >/dev/null
-
-       echo "[INFO]    Migrating ${PROJECT}"
-       pootle-manage sync_stores --overwrite --project=${PROJECT}
-
-       LANGUAGES=$(find . -maxdepth 1 -type d | cut -b3-)
-       for LANGUAGE in ${LANGUAGES}; do
-               pushd ${LANGUAGE} >/dev/null
-               rm -rf .converted
-               mkdir .converted
-
-               FILES=$(find . -name \*.xlf)
-               for FILE in ${FILES}; do
-                       T3ID=$(xmlstarlet sel -t -m "//xliff/file" -v "@t3:id" ${FILE} 2>/dev/null)
-                       if [ -z "${T3ID}" ]; then
-                               # Legacy file: keep it as-is
-                               continue
-                       fi
-                       TARGET_NAME=.converted/locallang.${T3ID}.xlf
-                       if [ -f ${TARGET_NAME} ]; then
-                               echo "[ERROR]   OOOPS! Duplicate T3ID ${T3ID} with $FILE" >&2
-                               exit 1
-                       fi
-                       mv $FILE ${TARGET_NAME}
-               done
-
-               mv .converted/*.xlf . >/dev/null 2>&1
-               rmdir .converted
-
-               # Remove empty directories
-               find . -type d | sort -r | xargs rmdir >/dev/null 2>&1
-                                       
-               popd >/dev/null
-       done
-
-       echo "[INFO]    Updating Pootle stores for ${PROJECT}"
-       pootle-manage update_stores --project=${PROJECT}
-
-       popd >/dev/null
-done
-
-popd >/dev/null
diff --git a/typo3/files/scripts/bin/migration/project-renamer b/typo3/files/scripts/bin/migration/project-renamer
deleted file mode 100755 (executable)
index 5fd1a4b..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env bash
-
-. /home/pootle/scripts/etc/pootle.conf
-. /home/pootle/scripts/etc/functions
-
-echo
-echo "This script will rename TYPO3.TYPO3.* projects into TYPO3.*"
-echo "Press ENTER to continue"
-read
-
-pushd ${POOTLE_PO} >/dev/null
-
-PROJECTS=$(find . -maxdepth 1 -name TYPO3.TYPO3.\* -type d | cut -b3- | sort)
-for PROJECT in ${PROJECTS}; do
-       NEW_NAME=$(echo ${PROJECT} | cut -b7-)
-       echo "[INFO]    Renaming project ${PROJECT}"
-
-       mysqlpipe "
-               UPDATE pootle_app_project SET
-                       code = REPLACE(code, 'TYPO3.TYPO3.', 'TYPO3.'),
-                       fullname = REPLACE(fullname, 'TYPO3.TYPO3.', 'TYPO3.')
-               WHERE code = '${PROJECT}'
-       "
-       mysqlpipe "
-               UPDATE pootle_app_translationproject SET
-                       real_path = REPLACE(real_path, 'TYPO3.TYPO3.', 'TYPO3.'),
-                       pootle_path = REPLACE(pootle_path, 'TYPO3.TYPO3.', 'TYPO3.')
-               WHERE real_path LIKE '${PROJECT}/%'
-       "
-       mysqlpipe "
-               UPDATE pootle_store_store SET
-                       file = REPLACE(file, 'TYPO3.TYPO3.', 'TYPO3.'),
-                       pootle_path = REPLACE(pootle_path, 'TYPO3.TYPO3.', 'TYPO3.')
-               WHERE file LIKE '${PROJECT}/%'
-       "
-
-       mv ${PROJECT} ${NEW_NAME}
-done
-
-popd >/dev/null
-
-echo "[INFO]    ====== UPDATE FINISHED ======"
\ No newline at end of file