[BUGFIX] Let Upgrade wizard recognize $GLOBALS['TYPO3_CONF_VARS'] 82/19482/3
authorAnja Leichsenring <aleichsenring@ab-softlab.de>
Mon, 1 Apr 2013 11:15:33 +0000 (13:15 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 3 Apr 2013 15:44:42 +0000 (17:44 +0200)
The LocalConfiguration wizard rewrites the existing localconf.php to the
new LocalConfiguration.php. To do so, the lines are read and analyzed to
retrieve the value and translate it to the new structure.

Until now, only lines containing the keyword $TYPO3_CONF_VARS are taken
into account. This patch extends the analysis to the keyword
$GLOBALS['TYPO3_CONF_VARS'].

Fixes: #39135
Releases: 6.0, 6.1
Change-Id: I880076d75a312926c8e968ad3ba883c41f364a62
Reviewed-on: https://review.typo3.org/19482
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Stefan Neufeind
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/install/Classes/CoreUpdates/LocalConfigurationUpdate.php

index e69c5d5..5860958 100644 (file)
@@ -77,12 +77,24 @@ class LocalConfigurationUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate
                                $line = trim($line);
                                $matches = array();
                                // Convert extList to array
-                               if (preg_match('/^\\$TYPO3_CONF_VARS\\[\'EXT\'\\]\\[\'extList\'\\] *={1} *\'(.+)\';{1}/', $line, $matches) === 1) {
+                               if (
+                                       preg_match('/^\\$TYPO3_CONF_VARS\\[\'EXT\'\\]\\[\'extList\'\\] *={1} *\'(.+)\';{1}/', $line, $matches) === 1
+                                       || preg_match('/^\\$GLOBALS\\[\'TYPO3_CONF_VARS\'\\]\\[\'EXT\'\\]\\[\'extList\'\\] *={1} *\'(.+)\';{1}/', $line, $matches) === 1
+                               ) {
                                        $extListAsArray = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $matches[1], TRUE);
                                        $typo3ConfigurationVariables[] = '$TYPO3_CONF_VARS[\'EXT\'][\'extListArray\'] = ' . var_export($extListAsArray, TRUE) . ';';
-                               } elseif (preg_match('/^\\$TYPO3_CONF_VARS.+;{1}/', $line, $matches) === 1) {
+                               } elseif (
+                                       preg_match('/^\\$TYPO3_CONF_VARS.+;{1}/', $line, $matches) === 1
+                               ) {
                                        $typo3ConfigurationVariables[] = $matches[0];
-                               } elseif (preg_match('/^\\$typo_db.+;{1}/', $line, $matches) === 1) {
+                               } elseif (
+                                       preg_match('/^\\$GLOBALS\\[\'TYPO3_CONF_VARS\'\\].+;{1}/', $line, $matches) === 1
+                               ) {
+                                       $lineWithoutGlobals = str_replace('$GLOBALS[\'TYPO3_CONF_VARS\']', '$TYPO3_CONF_VARS', $matches[0]);
+                                       $typo3ConfigurationVariables[] = $lineWithoutGlobals;
+                               } elseif (
+                                       preg_match('/^\\$typo_db.+;{1}/', $line, $matches) === 1
+                               ) {
                                        eval($matches[0]);
                                        if (isset($typo_db_host)) {
                                                $typo3DatabaseVariables['host'] = $typo_db_host;
@@ -96,7 +108,9 @@ class LocalConfigurationUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate
                                                $typo3DatabaseVariables['extTablesDefinitionScript'] = $typo_db_extTableDef_script;
                                        }
                                        unset($typo_db_host, $typo_db, $typo_db_username, $typo_db_password, $typo_db_extTableDef_script);
-                               } elseif (strlen($line) > 0 && preg_match('/^\\/\\/.+|^#.+|^<\\?php$|^<\\?$|^\\?>$/', $line, $matches) === 0) {
+                               } elseif (
+                                       strlen($line) > 0 && preg_match('/^\\/\\/.+|^#.+|^<\\?php$|^<\\?$|^\\?>$/', $line, $matches) === 0
+                               ) {
                                        $additionalConfiguration[] = $line;
                                }
                        }
@@ -130,4 +144,4 @@ class LocalConfigurationUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate
 }
 
 
-?>
\ No newline at end of file
+?>