[!!!][TASK] Rename TYPO3.TYPO3.* project into TYPO3.* 68/41468/2
authorXavier Perseguers <xavier@typo3.org>
Thu, 16 Jul 2015 13:52:26 +0000 (15:52 +0200)
committerXavier Perseguers <xavier@typo3.org>
Thu, 16 Jul 2015 13:58:40 +0000 (15:58 +0200)
Change-Id: Iaa31b403e043d1a2f51e2ec245f1483ae73c24dc
Reviewed-on: http://review.typo3.org/41468
Reviewed-by: Xavier Perseguers <xavier@typo3.org>
Tested-by: Xavier Perseguers <xavier@typo3.org>
README.rst
typo3/files/scripts/bin/build-language-pack
typo3/files/scripts/bin/build-sysext-language-pack
typo3/files/scripts/bin/migration/project-renamer [new file with mode: 0755]
typo3/files/scripts/bin/update-typo3-core-template
typo3/files/scripts/etc/functions

index 7ca2ec6..e1469b7 100644 (file)
@@ -69,10 +69,7 @@ Migrating data from production
 
       $ sudo su - pootle
          $ ~/scripts/bin/migration/migrate-typo3-xliff
-
-- Create Pootle projects:
-  - TYPO3.TYPO3.core.frontend
-  - TYPO3.TYPO3.core.compatibility6
+         $ ~/scripts/bin/migration/project-renamer
 
 - Update your password to be "password"::
 
index 7d88f5c..410e80b 100755 (executable)
@@ -6,7 +6,7 @@
 # -- no need to modify anything below
 
 FORCE_EXTENSION=$1
-EXT_PREFIX=TYPO3.TYPO3.ext
+EXT_PREFIX=TYPO3.ext
 EXT_PREFIX_LENGTH=$(($(echo -n ${EXT_PREFIX} | wc -c) + 2))
 if [ ! -z "${FORCE_EXTENSION}" ]; then
        EXTENSIONS=${FORCE_EXTENSION}
index 894140c..432787c 100755 (executable)
@@ -6,7 +6,7 @@
 # -- no need to modify anything below
 
 FORCE_EXTENSION=$1
-EXT_PREFIX=TYPO3.TYPO3.core
+EXT_PREFIX=TYPO3.core
 EXT_PREFIX_LENGTH=$(($(echo -n ${EXT_PREFIX} | wc -c) + 2))
 if [ ! -z "${FORCE_EXTENSION}" ]; then
        EXTENSIONS=${FORCE_EXTENSION}
diff --git a/typo3/files/scripts/bin/migration/project-renamer b/typo3/files/scripts/bin/migration/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
index 835de2e..43742d0 100755 (executable)
@@ -8,11 +8,11 @@ SOURCES=${LOCAL_GIT_CLONE_DIRECTORY}/TYPO3.CMS
 
 cd $(dirname $0)
 
-# Usage; check_typo3_typo3_core_projects_languages
-function check_typo3_typo3_core_projects_languages() {
+# Usage; check_typo3_core_projects_languages
+function check_typo3_core_projects_languages() {
        echo
        echo "[INFO]    Check available languages"
-       for CORE_PROJECT in $(list_typo3_typo3_core_projects); do
+       for CORE_PROJECT in $(list_typo3_core_projects); do
                check_available_languages $CORE_PROJECT
        done
 }
@@ -21,7 +21,7 @@ function check_typo3_typo3_core_projects_languages() {
 trap "exit" INT
 
 # Check project language configuration
-check_typo3_typo3_core_projects_languages
+check_typo3_core_projects_languages
 
 if [ ! -d ${SOURCES}/.git ]; then
        echo "[INIT]    Cloning TYPO3 CMS sources into ${SOURCES}"
@@ -63,7 +63,7 @@ for VERSION in ${VERSIONS}; do
 
        SYSTEM_EXTENSIONS=$(find . -maxdepth 1 -type d | cut -b3- | sort)
        for EXTENSION in ${SYSTEM_EXTENSIONS}; do
-               PROJECT="TYPO3.TYPO3.core.${EXTENSION}"
+               PROJECT="TYPO3.core.${EXTENSION}"
 
                if [ $(find ${EXTENSION} -name \*.xlf | wc -l) -eq 0 ]; then
                        continue
@@ -234,7 +234,7 @@ done
 
 pushd ${POOTLE_PO} >/dev/null
 
-PROJECTS=$(find . -maxdepth 1 -name TYPO3.TYPO3.core.\* -type d | cut -b3- | sort)
+PROJECTS=$(find . -maxdepth 1 -name TYPO3.core.\* -type d | cut -b3- | sort)
 
 for PROJECT in ${PROJECTS}; do
        echo "[INFO]    Refreshing Pootle for project ${PROJECT}"
index 85d4e99..fd80cc5 100644 (file)
@@ -21,10 +21,10 @@ function log_notice() {
 
 # Usage: mysqlpipe "sql-query"
 function mysqlpipe() {
-       local DATABASE_NAME=$(grep ^DATABASE_NAME ${POOTLE_CONF} | sed -r "s/.* = '([^']+)'.*/\1/")
-       local DATABASE_USER=$(grep ^DATABASE_USER ${POOTLE_CONF} | sed -r "s/.* = '([^']+)'.*/\1/")
-       local DATABASE_PASSWORD=$(grep ^DATABASE_PASSWORD ${POOTLE_CONF} | sed -r "s/.* = '([^']+)'.*/\1/")
-       local DATABASE_HOST=$(grep ^DATABASE_HOST ${POOTLE_CONF} | sed -r "s/.* = '([^']+)'.*/\1/")
+       local DATABASE_NAME=$(grep -A8 DATABASES ${POOTLE_CONF} | grep NAME | sed -r "s/^.*: '(.*)'.*$/\1/")
+       local DATABASE_USER=$(grep -A8 DATABASES ${POOTLE_CONF} | grep USER | sed -r "s/^.*: '(.*)'.*$/\1/")
+       local DATABASE_PASSWORD=$(grep -A8 DATABASES ${POOTLE_CONF} | grep PASSWORD | sed -r "s/^.*: '(.*)'.*$/\1/")
+       local DATABASE_HOST=$(grep -A8 DATABASES ${POOTLE_CONF} | grep HOST | sed -r "s/^.*: '(.*)'.*$/\1/")
 
        echo $@ | mysql -u ${DATABASE_USER} -p"${DATABASE_PASSWORD}" -h ${DATABASE_HOST} ${DATABASE_NAME} | sed '1d'
 }
@@ -58,12 +58,12 @@ function llxml2xliff() {
 
 # Usage: list_all_typo3_project
 function list_all_typo3_project() {
-       ls ${POOTLE_PO} | grep ^TYPO3.TYPO3
+       ls ${POOTLE_PO} | grep ^TYPO3.
 }
 
-# Usage: list_typo3_typo3_core_projects
-function list_typo3_typo3_core_projects() {
-       ls ${POOTLE_PO} | grep ^TYPO3.TYPO3.core
+# Usage: list_typo3_core_projects
+function list_typo3_core_projects() {
+       ls ${POOTLE_PO} | grep ^TYPO3.core.
 }
 
 # Usage: project_exist project.name