[TASK] Make Core\Configuration\ConfigurationManager non static
authorHelmut Hummel <helmut.hummel@typo3.org>
Wed, 3 Oct 2012 18:47:56 +0000 (20:47 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 18 Oct 2012 15:17:58 +0000 (17:17 +0200)
To have the possibility to remove dependencies from code that
calls the configuration manager, it has to be made non static.

Together with this change, all further configuration file logic
is moved to that class, to not expose internals in other
places. For that some methods needed to be made public, but
have been marked private, thus are not public API.

Further cleanup and simplification, especially not calling
makeInstance several times, will go in a separate change.

Resolves: #41052
Releases: 6.0

Change-Id: I8ddfa4a957d0b4955ed422a1deeebaf84340c2c1
Reviewed-on: http://review.typo3.org/15267
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
21 files changed:
typo3/cli_dispatch.phpsh
typo3/init.php
typo3/install/index.php
typo3/sysext/cms/tslib/index_ts.php
typo3/sysext/core/Classes/Configuration/ConfigurationManager.php
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Classes/Core/SystemEnvironmentBuilder.php
typo3/sysext/core/Classes/Extension/ExtensionManager.php
typo3/sysext/core/Tests/Unit/Configuration/ConfigurationManagerTest.php
typo3/sysext/core/Tests/Unit/Core/SystemEnvironmentBuilderTest.php
typo3/sysext/extensionmanager/Classes/Domain/Repository/ConfigurationItemRepository.php
typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php
typo3/sysext/extensionmanager/Tests/Unit/Domain/Repository/ConfigurationItemRepositoryTest.php
typo3/sysext/install/Classes/CoreUpdates/CharsetDefaultsUpdate.php
typo3/sysext/install/Classes/CoreUpdates/CompatVersionUpdate.php
typo3/sysext/install/Classes/CoreUpdates/InstallSysExtsUpdate.php
typo3/sysext/install/Classes/CoreUpdates/LocalConfigurationUpdate.php
typo3/sysext/install/Classes/Installer.php
typo3/sysext/install/Classes/Updates/AbstractUpdate.php
typo3/sysext/lang/Classes/Domain/Repository/LanguageRepository.php
typo3/sysext/saltedpasswords/Classes/Autoloader.php

index 4346749..f96e090 100755 (executable)
@@ -48,8 +48,8 @@ require __DIR__ . '/sysext/core/Classes/Core/CliBootstrap.php';
 require __DIR__ . '/sysext/core/Classes/Core/Bootstrap.php';
 \TYPO3\CMS\Core\Core\Bootstrap::getInstance()
        ->baseSetup('typo3/')
-       ->registerExtDirectComponents()
        ->populateLocalConfiguration()
+       ->registerExtDirectComponents()
        ->initializeCachingFramework()
        ->registerAutoloader()
        ->checkUtf8DatabaseSettingsOrDie()
index 2f26d1e..7f221e4 100644 (file)
@@ -62,8 +62,8 @@ require 'sysext/core/Classes/Core/Bootstrap.php';
 \TYPO3\CMS\Core\Core\Bootstrap::getInstance()
        ->startOutputBuffering()
        ->baseSetup('typo3/')
-       ->registerExtDirectComponents()
        ->populateLocalConfiguration()
+       ->registerExtDirectComponents()
        ->initializeCachingFramework()
        ->registerAutoloader()
        ->checkUtf8DatabaseSettingsOrDie()
index 6d2fea5..6b8b1ef 100755 (executable)
@@ -43,8 +43,8 @@ require '../sysext/core/Classes/Core/Bootstrap.php';
 require '../sysext/install/Classes/InstallBootstrap.php';
 \TYPO3\CMS\Install\InstallBootstrap::checkEnabledInstallToolOrDie();
 \TYPO3\CMS\Core\Core\Bootstrap::getInstance()
-       ->registerExtDirectComponents()
        ->populateLocalConfiguration()
+       ->registerExtDirectComponents()
        ->initializeCachingFramework()
        ->registerAutoloader()
        ->checkUtf8DatabaseSettingsOrDie()
index 3a257b8..24972b0 100644 (file)
@@ -43,8 +43,8 @@ define('TYPO3_MODE', 'FE');
 ob_start();
 
 \TYPO3\CMS\Core\Core\Bootstrap::getInstance()
-       ->registerExtDirectComponents()
        ->populateLocalConfiguration()
+       ->registerExtDirectComponents()
        ->initializeCachingFramework()
        ->registerAutoloader()
        ->checkUtf8DatabaseSettingsOrDie()
index ba7de01..36d84b9 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace TYPO3\CMS\Core\Configuration;
+use TYPO3\CMS\Core\Utility;
 
 /***************************************************************
  *  Copyright notice
@@ -37,7 +38,7 @@ namespace TYPO3\CMS\Core\Configuration;
  * @subpackage t3lib
  * @author Helge Funk <helge.funk@e-net.info>
  */
-class ConfigurationManager {
+class ConfigurationManager implements \TYPO3\CMS\Core\SingletonInterface {
 
        /**
         * Path to default TYPO3_CONF_VARS file, relative to PATH_site
@@ -61,7 +62,7 @@ class ConfigurationManager {
         *
         * @var array
         */
-       static protected $whiteListedLocalConfigurationPaths = array(
+       protected $whiteListedLocalConfigurationPaths = array(
                'EXT/extConf',
                'EXTCONF',
                'INSTALL/wizardDone',
@@ -73,8 +74,19 @@ class ConfigurationManager {
         *
         * @return array
         */
-       static public function getDefaultConfiguration() {
-               return require PATH_site . static::DEFAULT_CONFIGURATION_FILE;
+       public function getDefaultConfiguration() {
+               return require $this->getDefaultConfigurationFileResource();
+       }
+
+       /**
+        * Get the file resource of the default configuration file,
+        * currently the path and filename.
+        *
+        * @return string
+        * @access private
+        */
+       public function getDefaultConfigurationFileResource() {
+               return PATH_site . self::DEFAULT_CONFIGURATION_FILE;
        }
 
        /**
@@ -82,8 +94,30 @@ class ConfigurationManager {
         *
         * @return array Content array of local configuration file
         */
-       static public function getLocalConfiguration() {
-               return require PATH_site . static::LOCAL_CONFIGURATION_FILE;
+       public function getLocalConfiguration() {
+               return require $this->getLocalConfigurationFileResource();
+       }
+
+       /**
+        * Get the file resource of the local configuration file,
+        * currently the path and filename.
+        *
+        * @return string
+        * @access private
+        */
+       public function getLocalConfigurationFileResource() {
+               return PATH_site . self::LOCAL_CONFIGURATION_FILE;
+       }
+
+       /**
+        * Get the file resource of the aditional configuration file,
+        * currently the path and filename.
+        *
+        * @return string
+        * @access private
+        */
+       public function getAdditionalConfigurationFileResource() {
+               return PATH_site . self::ADDITIONAL_CONFIGURATION_FILE;
        }
 
        /**
@@ -92,9 +126,9 @@ class ConfigurationManager {
         * @param array $configurationToMerge Override configuration array
         * @return void
         */
-       static public function updateLocalConfiguration(array $configurationToMerge) {
-               $newLocalConfiguration = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule(static::getLocalConfiguration(), $configurationToMerge);
-               static::writeLocalConfiguration($newLocalConfiguration);
+       public function updateLocalConfiguration(array $configurationToMerge) {
+               $newLocalConfiguration = Utility\GeneralUtility::array_merge_recursive_overrule($this->getLocalConfiguration(), $configurationToMerge);
+               $this->writeLocalConfiguration($newLocalConfiguration);
        }
 
        /**
@@ -103,8 +137,8 @@ class ConfigurationManager {
         * @param string $path Path to search for
         * @return mixed Value at path
         */
-       static public function getDefaultConfigurationValueByPath($path) {
-               return \TYPO3\CMS\Core\Utility\ArrayUtility::getValueByPath(static::getDefaultConfiguration(), $path);
+       public function getDefaultConfigurationValueByPath($path) {
+               return Utility\ArrayUtility::getValueByPath($this->getDefaultConfiguration(), $path);
        }
 
        /**
@@ -113,8 +147,8 @@ class ConfigurationManager {
         * @param string $path Path to search for
         * @return mixed Value at path
         */
-       static public function getLocalConfigurationValueByPath($path) {
-               return \TYPO3\CMS\Core\Utility\ArrayUtility::getValueByPath(static::getLocalConfiguration(), $path);
+       public function getLocalConfigurationValueByPath($path) {
+               return Utility\ArrayUtility::getValueByPath($this->getLocalConfiguration(), $path);
        }
 
        /**
@@ -124,8 +158,8 @@ class ConfigurationManager {
         * @param string $path Path to search for
         * @return mixed
         */
-       static public function getConfigurationValueByPath($path) {
-               return \TYPO3\CMS\Core\Utility\ArrayUtility::getValueByPath(\TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule(static::getDefaultConfiguration(), static::getLocalConfiguration()), $path);
+       public function getConfigurationValueByPath($path) {
+               return Utility\ArrayUtility::getValueByPath(Utility\GeneralUtility::array_merge_recursive_overrule($this->getDefaultConfiguration(), $this->getLocalConfiguration()), $path);
        }
 
        /**
@@ -135,12 +169,12 @@ class ConfigurationManager {
         * @param mixed $value Value to set
         * @return boolean TRUE on success
         */
-       static public function setLocalConfigurationValueByPath($path, $value) {
+       public function setLocalConfigurationValueByPath($path, $value) {
                $result = FALSE;
-               if (static::isValidLocalConfigurationPath($path)) {
-                       $localConfiguration = static::getLocalConfiguration();
-                       $localConfiguration = \TYPO3\CMS\Core\Utility\ArrayUtility::setValueByPath($localConfiguration, $path, $value);
-                       $result = static::writeLocalConfiguration($localConfiguration);
+               if ($this->isValidLocalConfigurationPath($path)) {
+                       $localConfiguration = $this->getLocalConfiguration();
+                       $localConfiguration = Utility\ArrayUtility::setValueByPath($localConfiguration, $path, $value);
+                       $result = $this->writeLocalConfiguration($localConfiguration);
                }
                return $result;
        }
@@ -151,14 +185,76 @@ class ConfigurationManager {
         * @param array $pairs Key is path, value is value to set
         * @return boolean TRUE on success
         */
-       static public function setLocalConfigurationValuesByPathValuePairs(array $pairs) {
-               $localConfiguration = static::getLocalConfiguration();
+       public function setLocalConfigurationValuesByPathValuePairs(array $pairs) {
+               $localConfiguration = $this->getLocalConfiguration();
                foreach ($pairs as $path => $value) {
-                       if (static::isValidLocalConfigurationPath($path)) {
-                               $localConfiguration = \TYPO3\CMS\Core\Utility\ArrayUtility::setValueByPath($localConfiguration, $path, $value);
+                       if ($this->isValidLocalConfigurationPath($path)) {
+                               $localConfiguration = Utility\ArrayUtility::setValueByPath($localConfiguration, $path, $value);
+                       }
+               }
+               return $this->writeLocalConfiguration($localConfiguration);
+       }
+
+       /**
+        * Checks if the configuration can be written
+        *
+        * @return boolean
+        * @access private
+        */
+       public function canWriteConfiguration() {
+               $result = TRUE;
+               if (!@is_writable(PATH_typo3conf)) {
+                       $result = FALSE;
+               }
+               if (!@is_writable(($this->getLocalConfigurationFileResource())) && !@is_writable((PATH_site . self::LOCALCONF_FILE))) {
+                       $result = FALSE;
+               }
+               return $result;
+       }
+
+       /**
+        * Reads the configuration array and exports it to the global variable
+        *
+        * @access private
+        * @return void
+        */
+       public function exportConfiguration() {
+               if (@is_file(($this->getLocalConfigurationFileResource()))) {
+                       $localConfiguration = $this->getLocalConfiguration();
+                       if (is_array($localConfiguration)) {
+                               $GLOBALS['TYPO3_CONF_VARS'] = Utility\GeneralUtility::array_merge_recursive_overrule($this->getDefaultConfiguration(), $localConfiguration);
+                       } else {
+                               throw new \UnexpectedValueException('LocalConfiguration invalid.', 1349272276);
+                       }
+                       if (@is_file((PATH_site . self::ADDITIONAL_CONFIGURATION_FILE))) {
+                               require PATH_site . self::ADDITIONAL_CONFIGURATION_FILE;
                        }
+               } elseif (@is_file((PATH_site . self::LOCALCONF_FILE))) {
+                       $GLOBALS['TYPO3_CONF_VARS'] = $this->getDefaultConfiguration();
+                       // Legacy localconf.php handling
+                       // @deprecated: Can be removed if old localconf.php is not supported anymore
+                       global $TYPO3_CONF_VARS, $typo_db, $typo_db_username, $typo_db_password, $typo_db_host, $typo_db_extTableDef_script;
+                       require PATH_site . self::LOCALCONF_FILE;
+                       // If the localconf.php was not upgraded to LocalConfiguration.php, the default extListArray
+                       // from t3lib/stddb/DefaultConfiguration.php is still set. In this case we just unset
+                       // this key here, so t3lib_extMgm::getLoadedExtensionListArray() falls back to use extList string
+                       // @deprecated: This case can be removed later if localconf.php is not supported anymore
+                       unset($TYPO3_CONF_VARS['EXT']['extListArray']);
+                       // Write the old globals into the new place in the configuration array
+                       $GLOBALS['TYPO3_CONF_VARS']['DB'] = array();
+                       $GLOBALS['TYPO3_CONF_VARS']['DB']['database'] = $typo_db;
+                       $GLOBALS['TYPO3_CONF_VARS']['DB']['username'] = $typo_db_username;
+                       $GLOBALS['TYPO3_CONF_VARS']['DB']['password'] = $typo_db_password;
+                       $GLOBALS['TYPO3_CONF_VARS']['DB']['host'] = $typo_db_host;
+                       $GLOBALS['TYPO3_CONF_VARS']['DB']['extTablesDefinitionScript'] = $typo_db_extTableDef_script;
+                       unset($GLOBALS['typo_db']);
+                       unset($GLOBALS['typo_db_username']);
+                       unset($GLOBALS['typo_db_password']);
+                       unset($GLOBALS['typo_db_host']);
+                       unset($GLOBALS['typo_db_extTableDef_script']);
+               } else {
+                       throw new \RuntimeException('Neither ' . self::LOCAL_CONFIGURATION_FILE . ' (recommended) nor ' . self::LOCALCONF_FILE . ' (obsolete) could be found!', 1349272337);
                }
-               return static::writeLocalConfiguration($localConfiguration);
        }
 
        /**
@@ -167,34 +263,48 @@ class ConfigurationManager {
         * @param array $configuration The local configuration to be written
         * @throws \RuntimeException
         * @return boolean TRUE on success
+        * @access private
         */
-       static protected function writeLocalConfiguration(array $configuration) {
-               $localConfigurationFile = PATH_site . static::LOCAL_CONFIGURATION_FILE;
+       public function writeLocalConfiguration(array $configuration) {
+               $localConfigurationFile = $this->getLocalConfigurationFileResource();
                if (!@is_file($localConfigurationFile) || !@is_writable($localConfigurationFile)) {
                        throw new \RuntimeException($localConfigurationFile . ' does not exist or is not writable.', 1346323822);
                }
-               $configuration = \TYPO3\CMS\Core\Utility\ArrayUtility::sortByKeyRecursive($configuration);
-               $result = \TYPO3\CMS\Core\Utility\GeneralUtility::writeFile(
+               $configuration = Utility\ArrayUtility::sortByKeyRecursive($configuration);
+               $result = Utility\GeneralUtility::writeFile(
                        $localConfigurationFile,
-                       '<?php' . LF . 'return ' . \TYPO3\CMS\Core\Utility\ArrayUtility::arrayExport($configuration) . ';' . LF . '?>'
+                       '<?php' . LF . 'return ' . Utility\ArrayUtility::arrayExport($configuration) . ';' . LF . '?>'
                );
                return $result === FALSE ? FALSE : TRUE;
        }
 
        /**
+        * Write additional configuration array to typo3conf/AdditionalConfiguration.php
+        *
+        * @param array $additionalConfigurationLines The configuration lines to be written
+        * @throws \RuntimeException
+        * @return boolean TRUE on success
+        * @access private
+        */
+       public function writeAdditionalConfiguration(array $additionalConfigurationLines) {
+               $result = Utility\GeneralUtility::writeFile(PATH_site . self::ADDITIONAL_CONFIGURATION_FILE, '<?php' . LF . implode(LF, $additionalConfigurationLines) . LF . '?>');
+               return $result === FALSE ? FALSE : TRUE;
+       }
+
+       /**
         * Check if access / write to given path in local configuration is allowed.
         *
         * @param string $path Path to search for
         * @return boolean TRUE if access is allowed
         */
-       static protected function isValidLocalConfigurationPath($path) {
+       protected function isValidLocalConfigurationPath($path) {
                // Early return for white listed paths
-               foreach (static::$whiteListedLocalConfigurationPaths as $whiteListedPath) {
-                       if (\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($path, $whiteListedPath)) {
+               foreach ($this->whiteListedLocalConfigurationPaths as $whiteListedPath) {
+                       if (Utility\GeneralUtility::isFirstPartOfStr($path, $whiteListedPath)) {
                                return TRUE;
                        }
                }
-               return \TYPO3\CMS\Core\Utility\ArrayUtility::isValidPath(static::getDefaultConfiguration(), $path);
+               return Utility\ArrayUtility::isValidPath($this->getDefaultConfiguration(), $path);
        }
 
 }
index 7d0a96e..163fcd3 100644 (file)
@@ -113,13 +113,13 @@ class Bootstrap {
         */
        public function registerExtDirectComponents() {
                if (TYPO3_MODE === 'BE') {
-                       \TYPO3\CMS\Core\Extension\ExtensionManager::registerExtDirectComponent('TYPO3.Components.PageTree.DataProvider', PATH_t3lib . 'tree/pagetree/extdirect/class.t3lib_tree_pagetree_extdirect_tree.php:TYPO3\\CMS\\Backend\\Tree\\Pagetree\\ExtdirectTreeDataProvider', 'web', 'user,group');
-                       \TYPO3\CMS\Core\Extension\ExtensionManager::registerExtDirectComponent('TYPO3.Components.PageTree.Commands', PATH_t3lib . 'tree/pagetree/extdirect/class.t3lib_tree_pagetree_extdirect_tree.php:TYPO3\\CMS\\Backend\\Tree\\Pagetree\\ExtdirectTreeCommands', 'web', 'user,group');
-                       \TYPO3\CMS\Core\Extension\ExtensionManager::registerExtDirectComponent('TYPO3.Components.PageTree.ContextMenuDataProvider', PATH_t3lib . 'contextmenu/pagetree/extdirect/class.t3lib_contextmenu_pagetree_extdirect_contextmenu.php:TYPO3\\CMS\\Backend\\ContextMenu\\Pagetree\\Extdirect\\ContextMenuConfiguration', 'web', 'user,group');
-                       \TYPO3\CMS\Core\Extension\ExtensionManager::registerExtDirectComponent('TYPO3.LiveSearchActions.ExtDirect', PATH_t3lib . 'extjs/dataprovider/class.extdirect_dataprovider_backendlivesearch.php:extDirect_DataProvider_BackendLiveSearch', 'web_list', 'user,group');
-                       \TYPO3\CMS\Core\Extension\ExtensionManager::registerExtDirectComponent('TYPO3.BackendUserSettings.ExtDirect', PATH_t3lib . 'extjs/dataprovider/class.extdirect_dataprovider_beusersettings.php:TYPO3\\CMS\\Backend\\User\\ExtDirect\\BackendUserSettingsDataProvider');
-                       \TYPO3\CMS\Core\Extension\ExtensionManager::registerExtDirectComponent('TYPO3.CSH.ExtDirect', PATH_t3lib . 'extjs/dataprovider/class.extdirect_dataprovider_contexthelp.php:TYPO3\\CMS\\ContextHelp\\ExtDirect\\ContextHelpDataProvider');
-                       \TYPO3\CMS\Core\Extension\ExtensionManager::registerExtDirectComponent('TYPO3.ExtDirectStateProvider.ExtDirect', PATH_t3lib . 'extjs/dataprovider/class.extdirect_dataprovider_state.php:TYPO3\\CMS\\Backend\\InterfaceState\\ExtDirect\\DataProvider');
+                       \TYPO3\CMS\Core\Extension\ExtensionManager::registerExtDirectComponent('TYPO3.Components.PageTree.DataProvider', 'TYPO3\\CMS\\Backend\\Tree\\Pagetree\\ExtdirectTreeDataProvider', 'web', 'user,group');
+                       \TYPO3\CMS\Core\Extension\ExtensionManager::registerExtDirectComponent('TYPO3.Components.PageTree.Commands', 'TYPO3\\CMS\\Backend\\Tree\\Pagetree\\ExtdirectTreeCommands', 'web', 'user,group');
+                       \TYPO3\CMS\Core\Extension\ExtensionManager::registerExtDirectComponent('TYPO3.Components.PageTree.ContextMenuDataProvider', 'TYPO3\\CMS\\Backend\\ContextMenu\\Pagetree\\Extdirect\\ContextMenuConfiguration', 'web', 'user,group');
+                       \TYPO3\CMS\Core\Extension\ExtensionManager::registerExtDirectComponent('TYPO3.LiveSearchActions.ExtDirect', 'TYPO3\\CMS\\Backend\\Search\\LiveSearch\\ExtDirect\\LiveSearchDataProvider', 'web_list', 'user,group');
+                       \TYPO3\CMS\Core\Extension\ExtensionManager::registerExtDirectComponent('TYPO3.BackendUserSettings.ExtDirect', 'TYPO3\\CMS\\Backend\\User\\ExtDirect\\BackendUserSettingsDataProvider');
+                       \TYPO3\CMS\Core\Extension\ExtensionManager::registerExtDirectComponent('TYPO3.CSH.ExtDirect', 'TYPO3\\CMS\\ContextHelp\\ExtDirect\\ContextHelpDataProvider');
+                       \TYPO3\CMS\Core\Extension\ExtensionManager::registerExtDirectComponent('TYPO3.ExtDirectStateProvider.ExtDirect', 'TYPO3\\CMS\\Backend\\InterfaceState\\ExtDirect\\DataProvider');
                }
                return $this;
        }
@@ -132,45 +132,17 @@ class Bootstrap {
         * @return \TYPO3\CMS\Core\Core\Bootstrap
         */
        public function populateLocalConfiguration() {
-               if (@is_file((PATH_site . \TYPO3\CMS\Core\Configuration\ConfigurationManager::LOCAL_CONFIGURATION_FILE))) {
-                       $localConfiguration = \TYPO3\CMS\Core\Configuration\ConfigurationManager::getLocalConfiguration();
-                       if (is_array($localConfiguration)) {
-                               $GLOBALS['TYPO3_CONF_VARS'] = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($GLOBALS['TYPO3_CONF_VARS'], $localConfiguration);
-                       } else {
-                               die('LocalConfiguration invalid.');
-                       }
-                       if (@is_file((PATH_site . \TYPO3\CMS\Core\Configuration\ConfigurationManager::ADDITIONAL_CONFIGURATION_FILE))) {
-                               require PATH_site . \TYPO3\CMS\Core\Configuration\ConfigurationManager::ADDITIONAL_CONFIGURATION_FILE;
-                       }
-                       define('TYPO3_db', $GLOBALS['TYPO3_CONF_VARS']['DB']['database']);
-                       define('TYPO3_db_username', $GLOBALS['TYPO3_CONF_VARS']['DB']['username']);
-                       define('TYPO3_db_password', $GLOBALS['TYPO3_CONF_VARS']['DB']['password']);
-                       define('TYPO3_db_host', $GLOBALS['TYPO3_CONF_VARS']['DB']['host']);
-                       define('TYPO3_extTableDef_script', $GLOBALS['TYPO3_CONF_VARS']['DB']['extTablesDefinitionScript']);
-                       unset($GLOBALS['TYPO3_CONF_VARS']['DB']);
-               } elseif (@is_file((PATH_site . \TYPO3\CMS\Core\Configuration\ConfigurationManager::LOCALCONF_FILE))) {
-                       // Legacy localconf.php handling
-                       // @deprecated: Can be removed if old localconf.php is not supported anymore
-                       global $TYPO3_CONF_VARS, $typo_db, $typo_db_username, $typo_db_password, $typo_db_host, $typo_db_extTableDef_script;
-                       require PATH_site . \TYPO3\CMS\Core\Configuration\ConfigurationManager::LOCALCONF_FILE;
-                       // If the localconf.php was not upgraded to LocalConfiguration.php, the default extListArray
-                       // from t3lib/stddb/DefaultConfiguration.php is still set. In this case we just unset
-                       // this key here, so t3lib_extMgm::getLoadedExtensionListArray() falls back to use extList string
-                       // @deprecated: This case can be removed later if localconf.php is not supported anymore
-                       unset($TYPO3_CONF_VARS['EXT']['extListArray']);
-                       define('TYPO3_db', $typo_db);
-                       define('TYPO3_db_username', $typo_db_username);
-                       define('TYPO3_db_password', $typo_db_password);
-                       define('TYPO3_db_host', $typo_db_host);
-                       define('TYPO3_extTableDef_script', $typo_db_extTableDef_script);
-                       unset($GLOBALS['typo_db']);
-                       unset($GLOBALS['typo_db_username']);
-                       unset($GLOBALS['typo_db_password']);
-                       unset($GLOBALS['typo_db_host']);
-                       unset($GLOBALS['typo_db_extTableDef_script']);
-               } else {
-                       die('Neither ' . \TYPO3\CMS\Core\Configuration\ConfigurationManager::LOCAL_CONFIGURATION_FILE . ' (recommended) nor ' . \TYPO3\CMS\Core\Configuration\ConfigurationManager::LOCALCONF_FILE . ' (obsolete) could be found!');
+               try {
+                       \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->exportConfiguration();
+               } catch (\Exception $e) {
+                       die($e->getMessage());
                }
+               define('TYPO3_db', $GLOBALS['TYPO3_CONF_VARS']['DB']['database']);
+               define('TYPO3_db_username', $GLOBALS['TYPO3_CONF_VARS']['DB']['username']);
+               define('TYPO3_db_password', $GLOBALS['TYPO3_CONF_VARS']['DB']['password']);
+               define('TYPO3_db_host', $GLOBALS['TYPO3_CONF_VARS']['DB']['host']);
+               define('TYPO3_extTableDef_script', $GLOBALS['TYPO3_CONF_VARS']['DB']['extTablesDefinitionScript']);
+               unset($GLOBALS['TYPO3_CONF_VARS']['DB']);
                define('TYPO3_user_agent', 'User-Agent: ' . $GLOBALS['TYPO3_CONF_VARS']['HTTP']['userAgent']);
                return $this;
        }
index c1e370e..436ab46 100644 (file)
@@ -60,7 +60,6 @@ class SystemEnvironmentBuilder {
                self::handleMagicQuotesGpc();
                self::addCorePearPathToIncludePath();
                self::initializeGlobalVariables();
-               self::loadDefaultConfiguration();
                self::initializeGlobalTimeTrackingVariables();
                self::initializeBasicErrorReporting();
        }
@@ -207,13 +206,13 @@ class SystemEnvironmentBuilder {
        static protected function requireBaseClasses() {
                require_once __DIR__ . '/../Utility/GeneralUtility.php';
                require_once __DIR__ . '/../Utility/ArrayUtility.php';
+               require_once __DIR__ . '/../SingletonInterface.php';
                require_once __DIR__ . '/../Configuration/ConfigurationManager.php';
                require_once __DIR__ . '/../Extension/ExtensionManager.php';
                require_once __DIR__ . '/../Cache/Cache.php';
                require_once __DIR__ . '/../Cache/Exception.php';
                require_once __DIR__ . '/../Cache/Exception/NoSuchCacheException.php';
                require_once __DIR__ . '/../Cache/Exception/InvalidDataException.php';
-               require_once __DIR__ . '/../SingletonInterface.php';
                require_once __DIR__ . '/../Cache/CacheFactory.php';
                require_once __DIR__ . '/../Cache/CacheManager.php';
                require_once __DIR__ . '/../Cache/Frontend/FrontendInterface.php';
@@ -282,15 +281,6 @@ class SystemEnvironmentBuilder {
        }
 
        /**
-        * Load default TYPO3_CONF_VARS to globals
-        *
-        * @return void
-        */
-       static protected function loadDefaultConfiguration() {
-               $GLOBALS['TYPO3_CONF_VARS'] = \TYPO3\CMS\Core\Configuration\ConfigurationManager::getDefaultConfiguration();
-       }
-
-       /**
         * Initialize global time tracking variables.
         * These are helpers to for example output script parsetime at the end of a script.
         *
index 9688fbd..61cb729 100644 (file)
@@ -1758,14 +1758,7 @@ tt_content.' . $key . $prefix . ' {
         * @internal
         */
        static public function isLocalconfWritable() {
-               $result = TRUE;
-               if (!@is_writable(PATH_typo3conf)) {
-                       $result = FALSE;
-               }
-               if (!@is_writable((PATH_site . \TYPO3\CMS\Core\Configuration\ConfigurationManager::LOCALCONF_FILE)) && !@is_writable((PATH_site . \TYPO3\CMS\Core\Configuration\ConfigurationManager::LOCAL_CONFIGURATION_FILE))) {
-                       $result = FALSE;
-               }
-               return $result;
+               return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->canWriteConfiguration();
        }
 
        /**
@@ -1941,7 +1934,7 @@ tt_content.' . $key . $prefix . ' {
                if (static::isLoaded($extensionKey)) {
                        throw new \RuntimeException('Extension already loaded', 1342345486);
                }
-               $extList = \TYPO3\CMS\Core\Configuration\ConfigurationManager::getLocalConfigurationValueByPath('EXT/extListArray');
+               $extList = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->getLocalConfigurationValueByPath('EXT/extListArray');
                $extList[] = $extensionKey;
                static::writeNewExtensionList($extList);
        }
@@ -1963,7 +1956,7 @@ tt_content.' . $key . $prefix . ' {
                if (in_array($extensionKey, static::getRequiredExtensionListArray())) {
                        throw new \RuntimeException('Can not unload required extension', 1342348167);
                }
-               $extList = \TYPO3\CMS\Core\Configuration\ConfigurationManager::getLocalConfigurationValueByPath('EXT/extListArray');
+               $extList = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->getLocalConfigurationValueByPath('EXT/extListArray');
                $extList = array_diff($extList, array($extensionKey));
                static::writeNewExtensionList($extList);
        }
@@ -1978,10 +1971,10 @@ tt_content.' . $key . $prefix . ' {
         */
        static public function writeNewExtensionList(array $newExtensionList) {
                $extensionList = array_unique($newExtensionList);
-               \TYPO3\CMS\Core\Configuration\ConfigurationManager::setLocalConfigurationValueByPath('EXT/extListArray', $extensionList);
+               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath('EXT/extListArray', $extensionList);
                // @deprecated: extList as string is deprecated, the handling will be removed with 6.2
                // For now, this value is still set for better backwards compatibility
-               \TYPO3\CMS\Core\Configuration\ConfigurationManager::setLocalConfigurationValueByPath('EXT/extList', implode(',', $extensionList));
+               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath('EXT/extList', implode(',', $extensionList));
                static::removeCacheFiles();
        }
 
index c272790..027dd00 100644 (file)
@@ -40,6 +40,20 @@ class ConfigurationManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        protected $testFilesToDelete = array();
 
        /**
+        * @var \TYPO3\CMS\Core\Configuration\ConfigurationManager|\PHPUnit_Framework_MockObject_MockObject
+        */
+       protected $fixture;
+
+       public function setUp() {
+               $this->createFixtureWithMockedMethods(
+                       array(
+                               'getDefaultConfigurationFileResource',
+                               'getLocalConfigurationFileResource',
+                       )
+               );
+       }
+
+       /**
         * Tear down test case
         */
        public function tearDown() {
@@ -49,6 +63,17 @@ class ConfigurationManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        }
 
        /**
+        * @param array $methods
+        */
+       protected function createFixtureWithMockedMethods(array $methods) {
+               $this->fixture = $this->getMock(
+                       'TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager',
+                       $methods
+               );
+
+       }
+
+       /**
         * Tests concerning getDefaultConfiguration
         *
         */
@@ -57,19 +82,12 @@ class ConfigurationManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @expectedException \RuntimeException
         */
        public function getDefaultConfigurationExecutesDefinedDefaultConfigurationFile() {
-               $defaultConfigurationFile = 'typo3temp/' . uniqid('defaultConfiguration');
-               $namespace = 'TYPO3\\CMS\\Core\\Configuration';
-               $className = uniqid('ConfigurationManager');
-               eval(
-                       'namespace ' . $namespace . ';' .
-                       'class ' . $className . ' extends \\TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager {' .
-                       '  const DEFAULT_CONFIGURATION_FILE = \'' . $defaultConfigurationFile . '\';' .
-                       '}'
-               );
-               $className = $namespace . '\\' . $className;
-               file_put_contents(PATH_site . $defaultConfigurationFile, '<?php throw new \RuntimeException(\'foo\', 1310203814); ?>');
-               $this->testFilesToDelete[] = PATH_site . $defaultConfigurationFile;
-               $className::getDefaultConfiguration();
+               $defaultConfigurationFile = PATH_site . 'typo3temp/' . uniqid('defaultConfiguration');
+               file_put_contents($defaultConfigurationFile, '<?php throw new \RuntimeException(\'foo\', 1310203814); ?>');
+               $this->testFilesToDelete[] = $defaultConfigurationFile;
+
+               $this->fixture->expects($this->once())->method('getDefaultConfigurationFileResource')->will($this->returnValue($defaultConfigurationFile));
+               $this->fixture->getDefaultConfiguration();
        }
 
        /**
@@ -80,19 +98,12 @@ class ConfigurationManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @expectedException \RuntimeException
         */
        public function getLocalConfigurationExecutesDefinedConfigurationFile() {
-               $configurationFile = 'typo3temp/' . uniqid('localConfiguration');
-               $namespace = 'TYPO3\\CMS\\Core\\Configuration';
-               $className = uniqid('ConfigurationManager');
-               eval(
-                       'namespace ' . $namespace . ';' .
-                       'class ' . $className . ' extends \\TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager {' .
-                       '  const LOCAL_CONFIGURATION_FILE = \'' . $configurationFile . '\';' .
-                       '}'
-               );
-               $className = $namespace . '\\' . $className;
-               file_put_contents(PATH_site . $configurationFile, '<?php throw new \RuntimeException(\'foo\', 1310203815); ?>');
-               $this->testFilesToDelete[] = PATH_site . $configurationFile;
-               $className::getLocalConfiguration();
+               $configurationFile = PATH_site . 'typo3temp/' . uniqid('localConfiguration');
+               file_put_contents($configurationFile, '<?php throw new \RuntimeException(\'foo\', 1310203815); ?>');
+               $this->testFilesToDelete[] = $configurationFile;
+
+               $this->fixture->expects($this->once())->method('getLocalConfigurationFileResource')->will($this->returnValue($configurationFile));
+               $this->fixture->getLocalConfiguration();
        }
 
        /**
@@ -102,35 +113,32 @@ class ConfigurationManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function updateLocalConfigurationWritesNewMergedLocalConfigurationArray() {
-               $namespace = 'TYPO3\\CMS\\Core\\Configuration';
-               $className = uniqid('ConfigurationManager');
-               eval(
-                       'namespace ' . $namespace . '; ' .
-                       'class ' . $className . ' extends \\TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager {' .
-                       '  public static function getLocalConfiguration() {' .
-                       '    $currentLocalConfiguration = array(' .
-                       '      \'notChanged\' => 23,' .
-                       '      \'changed\' => \'unChanged\',' .
-                       '    );' .
-                       '    return $currentLocalConfiguration;' .
-                       '  }' .
-                       '  public static function writeLocalConfiguration($conf) {' .
-                       '    $expectedConfiguration = array(' .
-                       '      \'notChanged\' => 23,' .
-                       '      \'changed\' => \'changed\',' .
-                       '      \'new\' => \'new\',' . '    );' .
-                       '    if (!($conf === $expectedConfiguration)) {' .
-                       '      throw new Exception(\'broken\');' .
-                       '    }' .
-                       '  }' .
-                       '}'
+               $currentLocalConfiguration = array(
+                       'notChanged' => 23,
+                       'changed' => 'unChanged',
                );
-               $className = $namespace . '\\' . $className;
                $overrideConfiguration = array(
                        'changed' => 'changed',
                        'new' => 'new'
                );
-               $className::updateLocalConfiguration($overrideConfiguration);
+               $expectedConfiguration = array(
+                       'notChanged' => 23,
+                       'changed' => 'changed',
+                       'new' => 'new',
+               );
+
+               $this->createFixtureWithMockedMethods(array(
+                               'getLocalConfiguration',
+                               'writeLocalConfiguration',
+                       ));
+               $this->fixture->expects($this->once())
+                               ->method('getLocalConfiguration')
+                               ->will($this->returnValue($currentLocalConfiguration));
+               $this->fixture->expects($this->once())
+                               ->method('writeLocalConfiguration')
+                               ->with($expectedConfiguration);
+
+               $this->fixture->updateLocalConfiguration($overrideConfiguration);
        }
 
        /**
@@ -140,18 +148,17 @@ class ConfigurationManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function getDefaultConfigurationValueByPathReturnsCorrectValue() {
-               $namespace = 'TYPO3\\CMS\\Core\\Configuration';
-               $className = uniqid('ConfigurationManager');
-               eval(
-                       'namespace ' . $namespace . ';' .
-                       'class ' . $className . ' extends \\TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager {' .
-                       '  public static function getDefaultConfiguration() {' .
-                       '    return array(\'path\' => \'value\');' .
-                       '  }' .
-                       '}'
-               );
-               $className = $namespace . '\\' . $className;
-               $this->assertSame('value', $className::getDefaultConfigurationValueByPath('path'));
+               $this->createFixtureWithMockedMethods(array(
+                               'getDefaultConfiguration',
+                       ));
+               $this->fixture->expects($this->once())
+                               ->method('getDefaultConfiguration')
+                               ->will($this->returnValue(array(
+                                       'path' => 'value',
+                               )
+                       ));
+
+               $this->assertSame('value', $this->fixture->getDefaultConfigurationValueByPath('path'));
        }
 
        /**
@@ -161,18 +168,17 @@ class ConfigurationManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function getLocalConfigurationValueByPathReturnsCorrectValue() {
-               $namespace = 'TYPO3\\CMS\\Core\\Configuration';
-               $className = uniqid('ConfigurationManager');
-               eval(
-                       'namespace ' . $namespace . ';' .
-                       'class ' . $className . ' extends \\TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager {' .
-                       '  public static function getLocalConfiguration() {' .
-                       '    return array(\'path\' => \'value\');' .
-                       '  }' .
-                       '}'
-               );
-               $className = $namespace . '\\' . $className;
-               $this->assertSame('value', $className::getLocalConfigurationValueByPath('path'));
+               $this->createFixtureWithMockedMethods(array(
+                               'getLocalConfiguration',
+                       ));
+               $this->fixture->expects($this->once())
+                               ->method('getLocalConfiguration')
+                               ->will($this->returnValue(array(
+                                       'path' => 'value',
+                               )
+                       ));
+
+               $this->assertSame('value', $this->fixture->getLocalConfigurationValueByPath('path'));
        }
 
        /**
@@ -182,21 +188,24 @@ class ConfigurationManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function getConfigurationValueByPathReturnsCorrectValue() {
-               $namespace = 'TYPO3\\CMS\\Core\\Configuration';
-               $className = uniqid('ConfigurationManager');
-               eval(
-                       'namespace ' . $namespace . ';' .
-                       'class ' . $className . ' extends \\TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager {' .
-                       '  public static function getDefaultConfiguration() {' .
-                       '    return array(\'path\' => \'value\');' .
-                       '  }' .
-                       '  public static function getLocalConfiguration() {' .
-                       '    return array(\'path\' => \'valueOverride\');' .
-                       '  }' .
-                       '}'
-               );
-               $className = $namespace . '\\' . $className;
-               $this->assertSame('valueOverride', $className::getConfigurationValueByPath('path'));
+               $this->createFixtureWithMockedMethods(array(
+                               'getDefaultConfiguration',
+                               'getLocalConfiguration',
+                       ));
+               $this->fixture->expects($this->once())
+                               ->method('getDefaultConfiguration')
+                               ->will($this->returnValue(array(
+                                       'path' => 'value',
+                               )
+                       ));
+               $this->fixture->expects($this->once())
+                               ->method('getLocalConfiguration')
+                               ->will($this->returnValue(array(
+                                       'path' => 'valueOverride',
+                               )
+                       ));
+
+               $this->assertSame('valueOverride', $this->fixture->getConfigurationValueByPath('path'));
        }
 
        /**
@@ -206,55 +215,45 @@ class ConfigurationManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function setLocalConfigurationValueByPathReturnFalseIfPathIsNotValid() {
-               $namespace = 'TYPO3\\CMS\\Core\\Configuration';
-               $className = uniqid('ConfigurationManager');
-               eval(
-                       'namespace ' . $namespace . ';' .
-                       'class ' . $className . ' extends \\TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager {' .
-                       '  public static function isValidLocalConfigurationPath() {' .
-                       '    return FALSE;' .
-                       '  }' .
-                       '}'
-               );
-               $className = $namespace . '\\' . $className;
-               $this->assertFalse($className::setLocalConfigurationValueByPath('path', 'value'));
+               $this->createFixtureWithMockedMethods(array(
+                               'isValidLocalConfigurationPath',
+                       ));
+               $this->fixture->expects($this->once())
+                               ->method('isValidLocalConfigurationPath')
+                               ->will($this->returnValue(FALSE));
+
+               $this->assertFalse($this->fixture->setLocalConfigurationValueByPath('path', 'value'));
        }
 
        /**
         * @test
         */
        public function setLocalConfigurationValueByPathUpdatesValueDefinedByPath() {
-               $namespace = 'TYPO3\\CMS\\Core\\Configuration';
-               $className = uniqid('ConfigurationManager');
-               eval(
-                       'namespace ' . $namespace . ';' .
-                       'class ' . $className . ' extends \\TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager {' .
-                       '  public static function isValidLocalConfigurationPath() {' .
-                       '    return TRUE;' .
-                       '  }' .
-                       '  public static function getLocalConfiguration() {' .
-                       '    $currentLocalConfiguration = array(' .
-                       '      \'notChanged\' => 23,' .
-                       '      \'toUpdate\' => \'notUpdated\',' .
-                       '    );' .
-                       '    return $currentLocalConfiguration;' .
-                       '  }' .
-                       '  public static function writeLocalConfiguration($conf) {' .
-                       '    $expectedConfiguration = array(' .
-                       '      \'notChanged\' => 23,' .
-                       '      \'toUpdate\' => \'updated\',' .
-                       '    );' .
-                       '    if (!($conf === $expectedConfiguration)) {' .
-                       '      throw new Exception(\'broken\');' .
-                       '    }' .
-                       '    return TRUE;' .
-                       '  }' .
-                       '}'
+               $currentLocalConfiguration = array(
+                       'notChanged' => 23,
+                       'toUpdate' => 'notUpdated',
+               );
+               $expectedConfiguration = array(
+                       'notChanged' => 23,
+                       'toUpdate' => 'updated',
                );
-               $className = $namespace . '\\' . $className;
-               $pathToUpdate = 'toUpdate';
-               $valueToUpdate = 'updated';
-               $this->assertTrue($className::setLocalConfigurationValueByPath($pathToUpdate, $valueToUpdate));
+
+               $this->createFixtureWithMockedMethods(array(
+                               'isValidLocalConfigurationPath',
+                               'getLocalConfiguration',
+                               'writeLocalConfiguration',
+                       ));
+               $this->fixture->expects($this->once())
+                               ->method('isValidLocalConfigurationPath')
+                               ->will($this->returnValue(TRUE));
+               $this->fixture->expects($this->once())
+                               ->method('getLocalConfiguration')
+                               ->will($this->returnValue($currentLocalConfiguration));
+               $this->fixture->expects($this->once())
+                               ->method('writeLocalConfiguration')
+                               ->with($expectedConfiguration);
+
+               $this->fixture->setLocalConfigurationValueByPath('toUpdate', 'updated');
        }
 
        /**
@@ -264,41 +263,36 @@ class ConfigurationManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function setLocalConfigurationValuesByPathValuePairsSetsPathValuePairs() {
-               $namespace = 'TYPO3\\CMS\\Core\\Configuration';
-               $className = uniqid('ConfigurationManager');
-               eval(
-                       'namespace ' . $namespace . ';' .
-                       'class ' . $className .
-                       ' extends \\TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager {' .
-                       '  public static function isValidLocalConfigurationPath() {' .
-                       '    return TRUE;' .
-                       '  }' .
-                       '  public static function getLocalConfiguration() {' .
-                       '    $currentLocalConfiguration = array(' .
-                       '      \'notChanged\' => 23,' .
-                       '      \'toUpdate\' => \'notUpdated\',' .
-                       '    );' .
-                       '    return $currentLocalConfiguration;' .
-                       '  }' .
-                       '  public static function writeLocalConfiguration($conf) {' .
-                       '    $expectedConfiguration = array(' .
-                       '      \'notChanged\' => 23,' .
-                       '      \'toUpdate\' => \'updated\',' .
-                       '      \'new\' => \'new\',' .
-                       '    );' .
-                       '    if (!($conf === $expectedConfiguration)) {' .
-                       '      throw new Exception(\'broken\');' .
-                       '    }' .
-                       '    return TRUE;' .
-                       '  }' .
-                       '}'
+               $currentLocalConfiguration = array(
+                       'notChanged' => 23,
+                       'toUpdate' => 'notUpdated',
                );
-               $className = $namespace . '\\' . $className;
+               $expectedConfiguration = array(
+                       'notChanged' => 23,
+                       'toUpdate' => 'updated',
+                       'new' => 'new',
+               );
+
+               $this->createFixtureWithMockedMethods(array(
+                               'isValidLocalConfigurationPath',
+                               'getLocalConfiguration',
+                               'writeLocalConfiguration',
+                       ));
+               $this->fixture->expects($this->any())
+                               ->method('isValidLocalConfigurationPath')
+                               ->will($this->returnValue(TRUE));
+               $this->fixture->expects($this->once())
+                               ->method('getLocalConfiguration')
+                               ->will($this->returnValue($currentLocalConfiguration));
+               $this->fixture->expects($this->once())
+                               ->method('writeLocalConfiguration')
+                               ->with($expectedConfiguration);
+
                $pairs = array(
                        'toUpdate' => 'updated',
                        'new' => 'new'
                );
-               $this->assertTrue($className::setLocalConfigurationValuesByPathValuePairs($pairs));
+               $this->fixture->setLocalConfigurationValuesByPathValuePairs($pairs);
        }
 
        /**
@@ -310,53 +304,34 @@ class ConfigurationManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         */
        public function writeLocalConfigurationThrowsExceptionForInvalidFile() {
                $configurationFile = 'typo3temp/' . uniqid('localConfiguration');
-               $namespace = 'TYPO3\\CMS\\Core\\Configuration';
-               $className = uniqid('ConfigurationManager');
-               eval(
-                       'namespace ' . $namespace . ';' .
-                       'class ' . $className . ' extends \\TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager {' .
-                       '  const LOCAL_CONFIGURATION_FILE = \'' . $configurationFile . '\';' .
-                       '  public static function writeLocalConfiguration($conf) {' .
-                       '    return parent::writeLocalConfiguration($conf);' .
-                       '  }' .
-                       '}'
-               );
-               $className = $namespace . '\\' . $className;
+               $this->fixture->expects($this->once())->method('getLocalConfigurationFileResource')->will($this->returnValue($configurationFile));
+
                $pairs = array(
                        'foo' => 42,
                        'bar' => 23
                );
-               $className::writeLocalConfiguration($pairs);
+               $this->fixture->writeLocalConfiguration($pairs);
        }
 
        /**
         * @test
         */
        public function writeLocalConfigurationWritesSortedContentToConfigurationFile() {
-               $configurationFile = 'typo3temp/' . uniqid('localConfiguration');
-               if (!is_file(PATH_site . $configurationFile)) {
-                       if (!$fh = fopen(PATH_site . $configurationFile, 'wb')) {
+               $configurationFile = PATH_site . 'typo3temp/' . uniqid('localConfiguration');
+               if (!is_file($configurationFile)) {
+                       if (!$fh = fopen($configurationFile, 'wb')) {
                                $this->markTestSkipped('Can not create file ' . $configurationFile . '. Please check your write permissions.');
                        }
                        fclose($fh);
                }
 
-               if (!@is_file(PATH_site . $configurationFile)) {
+               if (!@is_file($configurationFile)) {
                        throw new \RuntimeException('File ' . $configurationFile . ' could not be found. Please check your write permissions', 1346364362);
                }
-               $this->testFilesToDelete[] = PATH_site . $configurationFile;
-               $namespace = 'TYPO3\\CMS\\Core\\Configuration';
-               $className = uniqid('ConfigurationManager');
-               eval(
-                       'namespace ' . $namespace . ';' .
-                       'class ' . $className . ' extends \\TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager {' .
-                       '  const LOCAL_CONFIGURATION_FILE = \'' . $configurationFile . '\';' .
-                       '  public static function writeLocalConfiguration($conf) {' .
-                       '    return parent::writeLocalConfiguration($conf);' .
-                       '  }' .
-                       '}'
-               );
-               $className = $namespace . '\\' . $className;
+               $this->testFilesToDelete[] = $configurationFile;
+
+               $this->fixture->expects($this->once())->method('getLocalConfigurationFileResource')->will($this->returnValue($configurationFile));
+
                $pairs = array(
                        'foo' => 42,
                        'bar' => 23
@@ -369,8 +344,8 @@ class ConfigurationManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                                ');' . LF .
                        '?>';
 
-               $className::writeLocalConfiguration($pairs);
-               $this->assertSame($expectedContent, file_get_contents(PATH_site . $configurationFile));
+               $this->fixture->writeLocalConfiguration($pairs);
+               $this->assertSame($expectedContent, file_get_contents($configurationFile));
        }
 
        /**
@@ -380,22 +355,20 @@ class ConfigurationManagerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function isValidLocalConfigurationPathAcceptsWhitelistedPath() {
-               $namespace = 'TYPO3\\CMS\\Core\\Configuration';
-               $className = uniqid('ConfigurationManager');
-               eval(
-                       'namespace ' . $namespace . ';' .
-                       'class ' . $className . ' extends \\TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager {' .
-                       '  protected static $whiteListedLocalConfigurationPaths = array(' .
-                       '    \'foo\',' .
-                       '  );' .
-                       '  public static function isValidLocalConfigurationPath($path) {' .
-                       '    return parent::isValidLocalConfigurationPath($path);' .
-                       '  }' .
-                       '}'
-               );
-               $className = $namespace . '\\' . $className;
-               $this->assertTrue($className::isValidLocalConfigurationPath('foo'));
+               /** @var $fixture \TYPO3\CMS\Core\Configuration\ConfigurationManager|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
+               $fixture = $this->getAccessibleMock('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager', array('dummy'));
+               $fixture->_set('whiteListedLocalConfigurationPaths', array('foo/bar'));
+               $this->assertTrue($fixture->_call('isValidLocalConfigurationPath', 'foo/bar/baz'));
        }
 
+       /**
+        * @test
+        */
+       public function isValidLocalConfigurationPathDeniesNotWhitelistedPath() {
+               /** @var $fixture \TYPO3\CMS\Core\Configuration\ConfigurationManager|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */
+               $fixture = $this->getAccessibleMock('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager', array('dummy'));
+               $fixture->_set('whiteListedLocalConfigurationPaths', array('foo/bar'));
+               $this->assertFalse($fixture->_call('isValidLocalConfigurationPath', 'bar/baz'));
+       }
 }
 ?>
\ No newline at end of file
index 92c8ab8..7ece35e 100644 (file)
@@ -205,15 +205,6 @@ class SystemEnvironmentBuilderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        }
 
        /**
-        * @test
-        */
-       public function loadDefaultConfigurationPopulatesTypo3ConfVarsArray() {
-               unset($GLOBALS['TYPO3_CONF_VARS']);
-               $this->fixture->_call('loadDefaultConfiguration');
-               $this->assertInternalType('array', $GLOBALS['TYPO3_CONF_VARS']);
-       }
-
-       /**
         * Data provider for initializeGlobalTimeTrackingVariablesSetsGlobalVariables
         *
         * @return array
index bbddde5..e1e2834 100644 (file)
@@ -38,6 +38,11 @@ class ConfigurationItemRepository {
        protected $objectManager;
 
        /**
+        * @var \TYPO3\CMS\Core\Configuration\ConfigurationManager
+        */
+       protected $configurationManager;
+
+       /**
         * Injects the object manager
         *
         * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
@@ -48,6 +53,16 @@ class ConfigurationItemRepository {
        }
 
        /**
+        * Inject configuration manager
+        *
+        * @param \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager
+        * @return void
+        */
+       public function injectConfigurationManager(\TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager) {
+               $this->configurationManager = $configurationManager;
+       }
+
+       /**
         * Find configuration options by extension
         *
         * @param array $extension array with extension information
@@ -194,7 +209,7 @@ class ConfigurationItemRepository {
        protected function mergeWithExistingConfiguration(array $configuration, array $extension) {
                try {
                        $currentExtensionConfig = unserialize(
-                               \TYPO3\CMS\Core\Configuration\ConfigurationManager::getConfigurationValueByPath(
+                               $this->configurationManager->getConfigurationValueByPath(
                                        'EXT/extConf/' . $extension['key']
                                )
                        );
index 36581ed..f901963 100644 (file)
@@ -66,6 +66,11 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface {
        protected $databaseUtility;
 
        /**
+        * @var \TYPO3\CMS\Core\Configuration\ConfigurationManager
+        */
+       protected $configurationManager;
+
+       /**
         * @var \TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository
         */
        public $extensionRepository;
@@ -103,6 +108,16 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface {
        }
 
        /**
+        * Inject configuration manager
+        *
+        * @param \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager
+        * @return void
+        */
+       public function injectConfigurationManager(\TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager) {
+               $this->configurationManager = $configurationManager;
+       }
+
+       /**
         * Inject emConfUtility
         *
         * @param \TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository $extensionRepository
@@ -227,7 +242,7 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface {
        public function reloadCaches() {
                \TYPO3\CMS\Core\Extension\ExtensionManager::removeCacheFiles();
                // Set new extlist / extlistArray for extension load changes at runtime
-               $localConfiguration = \TYPO3\CMS\Core\Configuration\ConfigurationManager::getLocalConfiguration();
+               $localConfiguration = $this->configurationManager->getLocalConfiguration();
                $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'] = $localConfiguration['EXT']['extList'];
                $GLOBALS['TYPO3_CONF_VARS']['EXT']['extListArray'] = $localConfiguration['EXT']['extListArray'];
                \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->populateTypo3LoadedExtGlobal(FALSE)->loadAdditionalConfigurationFromExtensions(FALSE);
@@ -300,7 +315,7 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface {
         * @return void
         */
        public function writeExtensionTypoScriptStyleConfigurationToLocalconf($extensionKey, $newConfiguration) {
-               \TYPO3\CMS\Core\Configuration\ConfigurationManager::setLocalConfigurationValueByPath('EXT/extConf/' . $extensionKey, serialize($newConfiguration));
+               $this->configurationManager->setLocalConfigurationValueByPath('EXT/extConf/' . $extensionKey, serialize($newConfiguration));
                \TYPO3\CMS\Core\Extension\ExtensionManager::removeCacheFiles();
        }
 
index ab4197e..f44337e 100644 (file)
@@ -47,34 +47,15 @@ class ConfigurationItemRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\Base
         * @return void
         */
        public function setUp() {
-               $className = $this->getConfigurationItemRepositoryMock();
-               $this->configurationItemRepository = new $className();
-       }
-
-       /**
-        *
-        * @return string
-        */
-       public function getConfigurationItemRepositoryMock() {
-               $className = 'Tx_Extensionmanager_Repository_ConfigurationItemRepositoryMock';
-               if (!class_exists($className, FALSE)) {
-                       eval('class ' . $className . ' extends TYPO3\\CMS\\Extensionmanager\\Domain\\Repository\\ConfigurationItemRepository {' .
-                       '  public function addMetaInformation(&$configuration) {' .
-                       '    return parent::addMetaInformation($configuration);' .
-                       '  }' .
-                       '  public function extractInformationForConfigFieldsOfTypeUser($configurationOption) {' .
-                       '    return parent::extractInformationForConfigFieldsOfTypeUser($configurationOption);' .
-                       '  }' .
-                       '  public function extractInformationForConfigFieldsOfTypeOptions($configurationOption) {' .
-                       '    return parent::extractInformationForConfigFieldsOfTypeOptions($configurationOption);' .
-                       '  }' .
-                       '  public function mergeWithExistingConfiguration(array $configuration, array $extension) {' .
-                       '    return parent::mergeWithExistingConfiguration($configuration, $extension);' .
-                       '  }' .
-                       '}'
+               $this->configurationItemRepository = $this->getAccessibleMock(
+                       'TYPO3\\CMS\\Extensionmanager\\Domain\\Repository\\ConfigurationItemRepository',
+                       array('dummy',)
+               );
+               $configurationManagerMock = $this->getAccessibleMock(
+                       'TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager',
+                       array('dummy')
                );
-               }
-               return $className;
+               $this->configurationItemRepository->_set('configurationManager', $configurationManagerMock);
        }
 
        /**
@@ -87,7 +68,7 @@ class ConfigurationItemRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\Base
                        '__meta__' => 'metaInformation',
                        'test123' => 'test123'
                );
-               $this->configurationItemRepository->addMetaInformation($configuration);
+               $this->configurationItemRepository->_callRef('addMetaInformation', $configuration);
                $this->assertEquals(array('test123' => 'test123'), $configuration);
        }
 
@@ -100,7 +81,7 @@ class ConfigurationItemRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\Base
                        '__meta__' => 'metaInformation',
                        'test123' => 'test123'
                );
-               $meta = $this->configurationItemRepository->addMetaInformation($configuration);
+               $meta = $this->configurationItemRepository->_callRef('addMetaInformation', $configuration);
                $this->assertEquals('metaInformation', $meta);
        }
 
@@ -160,7 +141,7 @@ class ConfigurationItemRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\Base
         * @return void
         */
        public function extractInformationForConfigFieldsOfTypeUserAddsGenericAndTypeInformation($configurationOption) {
-               $configurationOptionModified = $this->configurationItemRepository->extractInformationForConfigFieldsOfTypeUser($configurationOption);
+               $configurationOptionModified = $this->configurationItemRepository->_callRef('extractInformationForConfigFieldsOfTypeUser', $configurationOption);
                $this->assertEquals('user', $configurationOptionModified['type']);
                $this->assertEquals($configurationOption['comparisonGeneric'], $configurationOptionModified['generic']);
        }
@@ -187,7 +168,7 @@ class ConfigurationItemRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\Base
                        ),
                        'typeComparisonValue' => 'options'
                );
-               $optionModified = $this->configurationItemRepository->extractInformationForConfigFieldsOfTypeOptions($option);
+               $optionModified = $this->configurationItemRepository->_callRef('extractInformationForConfigFieldsOfTypeOptions', $option);
                $this->assertArrayHasKey('generic', $optionModified);
                $this->assertArrayHasKey('type', $optionModified);
                $this->assertArrayHasKey('label', $optionModified);
@@ -230,7 +211,7 @@ class ConfigurationItemRepositoryTest extends \TYPO3\CMS\Extbase\Tests\Unit\Base
                );
 
                // No value is set
-               $configuration = $this->configurationItemRepository->mergeWithExistingConfiguration($defaultConfiguration, $extension);
+               $configuration = $this->configurationItemRepository->_callRef('mergeWithExistingConfiguration', $defaultConfiguration, $extension);
                $this->assertEquals($defaultConfiguration, $configuration);
        }
 
index 521f72b..60d4c67 100644 (file)
@@ -64,13 +64,13 @@ class CharsetDefaultsUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
        public function performUpdate(array &$dbQueries, &$customMessages) {
                // Update "setDBinit" setting
                $result1 = FALSE;
-               if (\TYPO3\CMS\Core\Configuration\ConfigurationManager::getLocalConfigurationValueByPath('SYS/setDBinit') === '-1') {
-                       $result1 = \TYPO3\CMS\Core\Configuration\ConfigurationManager::setLocalConfigurationValueByPath('SYS/setDBinit', '');
+               if (\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->getLocalConfigurationValueByPath('SYS/setDBinit') === '-1') {
+                       $result1 = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath('SYS/setDBinit', '');
                }
                // Update the "forceCharset" setting
                $result2 = FALSE;
-               if (\TYPO3\CMS\Core\Configuration\ConfigurationManager::getLocalConfigurationValueByPath('BE/forceCharset') !== '') {
-                       $result2 = \TYPO3\CMS\Core\Configuration\ConfigurationManager::setLocalConfigurationValueByPath('BE/forceCharset', '');
+               if (\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->getLocalConfigurationValueByPath('BE/forceCharset') !== '') {
+                       $result2 = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath('BE/forceCharset', '');
                }
                if ($result1 && $result2) {
                        $customMessages[] = 'The configuration was successfully updated.';
index f2aa4ee..9a9088c 100644 (file)
@@ -185,7 +185,7 @@ class CompatVersionUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
                        $customMessages .= 'If you want to see what you need to do to use the new features, run the update wizard again!';
                }
                $version = $this->userInput['version'] ? $this->userInput['version'] : TYPO3_branch;
-               \TYPO3\CMS\Core\Configuration\ConfigurationManager::setLocalConfigurationValueByPath('SYS/compat_version', $version);
+               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath('SYS/compat_version', $version);
                $customMessages .= '<br />The compatibility version has been set to ' . $version . '.';
                return 1;
        }
index c952a3f..79c54b9 100644 (file)
@@ -309,7 +309,7 @@ class InstallSysExtsUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate {
         * @return void
         */
        protected function markWizardAsDone() {
-               \TYPO3\CMS\Core\Configuration\ConfigurationManager::setLocalConfigurationValueByPath(
+               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath(
                        'INSTALL/wizardDone/' . get_class($this),
                        json_encode($this->systemExtensions)
                );
index 8eb1d96..abd8888 100644 (file)
@@ -109,12 +109,12 @@ class LocalConfigurationUpdate extends \TYPO3\CMS\Install\Updates\AbstractUpdate
                        $TYPO3_CONF_VARS['DB'] = $typo3DatabaseVariables;
                        $TYPO3_CONF_VARS = \TYPO3\CMS\Core\Utility\ArrayUtility::sortByKeyRecursive($TYPO3_CONF_VARS);
                        // Write out new LocalConfiguration file
-                       \TYPO3\CMS\Core\Utility\GeneralUtility::writeFile(PATH_site . \TYPO3\CMS\Core\Configuration\ConfigurationManager::LOCAL_CONFIGURATION_FILE, '<?php' . LF . 'return ' . \TYPO3\CMS\Core\Utility\ArrayUtility::arrayExport($TYPO3_CONF_VARS) . ';' . LF . '?>');
+                       \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->writeLocalConfiguration($TYPO3_CONF_VARS);
                        // Write out new AdditionalConfiguration file
                        if (sizeof($additionalConfiguration) > 0) {
-                               \TYPO3\CMS\Core\Utility\GeneralUtility::writeFile(PATH_site . \TYPO3\CMS\Core\Configuration\ConfigurationManager::ADDITIONAL_CONFIGURATION_FILE, '<?php' . LF . implode(LF, $additionalConfiguration) . LF . '?>');
+                               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->writeAdditionalConfiguration($additionalConfiguration);
                        } else {
-                               @unlink((PATH_site . \TYPO3\CMS\Core\Configuration\ConfigurationManager::ADDITIONAL_CONFIGURATION_FILE));
+                               @unlink(\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->getAdditionalConfigurationFileResource());
                        }
                        rename(PATH_site . 'typo3conf/localconf.php', PATH_site . 'typo3conf/localconf.obsolete.php');
                        $result = TRUE;
index 23d2832..d385913 100644 (file)
@@ -1687,7 +1687,7 @@ REMOTE_ADDR was \'' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE
         * @todo Define visibility
         */
        public function generateConfigForm($type = '') {
-               $default_config_content = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl(PATH_site . \TYPO3\CMS\Core\Configuration\ConfigurationManager::DEFAULT_CONFIGURATION_FILE);
+               $default_config_content = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->getDefaultConfigurationFileResource());
                $commentArr = $this->getDefaultConfigArrayComments($default_config_content);
                switch ($type) {
                case 'get_form':
@@ -3213,29 +3213,29 @@ REMOTE_ADDR was \'' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE
                                foreach ($this->INSTALL['LocalConfiguration'] as $key => $value) {
                                        switch ((string) $key) {
                                        case 'disable_exec_function':
-                                               if (strcmp(\TYPO3\CMS\Core\Configuration\ConfigurationManager::getConfigurationValueByPath('BE/disable_exec_function'), $value)) {
+                                               if (strcmp(\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->getConfigurationValueByPath('BE/disable_exec_function'), $value)) {
                                                        $localConfigurationPathValuePairs['BE/disable_exec_function'] = $value ? 1 : 0;
                                                }
                                                break;
                                        case 'sitename':
-                                               if (strcmp(\TYPO3\CMS\Core\Configuration\ConfigurationManager::getConfigurationValueByPath('SYS/sitename'), $value)) {
+                                               if (strcmp(\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->getConfigurationValueByPath('SYS/sitename'), $value)) {
                                                        $localConfigurationPathValuePairs['SYS/sitename'] = $value;
                                                }
                                                break;
                                        case 'encryptionKey':
-                                               if (strcmp(\TYPO3\CMS\Core\Configuration\ConfigurationManager::getConfigurationValueByPath('SYS/encryptionKey'), $value)) {
+                                               if (strcmp(\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->getConfigurationValueByPath('SYS/encryptionKey'), $value)) {
                                                        $localConfigurationPathValuePairs['SYS/encryptionKey'] = $value;
                                                        // The session object in this request must use the new encryption key to write to the right session folder
                                                        $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = $value;
                                                }
                                                break;
                                        case 'compat_version':
-                                               if (strcmp(\TYPO3\CMS\Core\Configuration\ConfigurationManager::getConfigurationValueByPath('SYS/compat_version'), $value)) {
+                                               if (strcmp(\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->getConfigurationValueByPath('SYS/compat_version'), $value)) {
                                                        $localConfigurationPathValuePairs['SYS/compat_version'] = $value;
                                                }
                                                break;
                                        case 'im_combine_filename':
-                                               if (strcmp(\TYPO3\CMS\Core\Configuration\ConfigurationManager::getConfigurationValueByPath('GFX/im_combine_filename'), $value)) {
+                                               if (strcmp(\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->getConfigurationValueByPath('GFX/im_combine_filename'), $value)) {
                                                        $localConfigurationPathValuePairs['GFX/im_combine_filename'] = $value;
                                                }
                                                break;
@@ -3244,13 +3244,13 @@ REMOTE_ADDR was \'' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE
                                        case 'gdlib_png':
 
                                        case 'im':
-                                               if (strcmp(\TYPO3\CMS\Core\Configuration\ConfigurationManager::getConfigurationValueByPath('GFX/' . $key), $value)) {
+                                               if (strcmp(\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->getConfigurationValueByPath('GFX/' . $key), $value)) {
                                                        $localConfigurationPathValuePairs['GFX/' . $key] = $value ? 1 : 0;
                                                }
                                                break;
                                        case 'im_path':
                                                list($value, $version) = explode('|', $value);
-                                               if (strcmp(\TYPO3\CMS\Core\Configuration\ConfigurationManager::getConfigurationValueByPath('GFX/' . $key), $value)) {
+                                               if (strcmp(\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->getConfigurationValueByPath('GFX/' . $key), $value)) {
                                                        $localConfigurationPathValuePairs['GFX/' . $key] = $value;
                                                }
                                                if (doubleval($version) > 0 && doubleval($version) < 4) {
@@ -3260,18 +3260,18 @@ REMOTE_ADDR was \'' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE
                                                        // Assume ImageMagick 6.x
                                                        $value_ext = 'im6';
                                                }
-                                               if (strcmp(strtolower(\TYPO3\CMS\Core\Configuration\ConfigurationManager::getConfigurationValueByPath('GFX/im_version_5')), $value_ext)) {
+                                               if (strcmp(strtolower(\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->getConfigurationValueByPath('GFX/im_version_5')), $value_ext)) {
                                                        $localConfigurationPathValuePairs['GFX/im_version_5'] = $value_ext;
                                                }
                                                break;
                                        case 'im_path_lzw':
                                                list($value) = explode('|', $value);
-                                               if (strcmp(\TYPO3\CMS\Core\Configuration\ConfigurationManager::getConfigurationValueByPath('GFX/' . $key), $value)) {
+                                               if (strcmp(\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->getConfigurationValueByPath('GFX/' . $key), $value)) {
                                                        $localConfigurationPathValuePairs['GFX/' . $key] = $value;
                                                }
                                                break;
                                        case 'TTFdpi':
-                                               if (strcmp(\TYPO3\CMS\Core\Configuration\ConfigurationManager::getConfigurationValueByPath('GFX/TTFdpi'), $value)) {
+                                               if (strcmp(\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->getConfigurationValueByPath('GFX/TTFdpi'), $value)) {
                                                        $localConfigurationPathValuePairs['GFX/TTFdpi'] = $value;
                                                }
                                                break;
@@ -3303,7 +3303,7 @@ REMOTE_ADDR was \'' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REMOTE
        protected function setLocalConfigurationValues(array $pathValuePairs) {
                // Get the template file
                $templateFile = @file_get_contents((PATH_site . $this->templateFilePath . 'WriteToLocalConfControl.html'));
-               if (\TYPO3\CMS\Core\Configuration\ConfigurationManager::setLocalConfigurationValuesByPathValuePairs($pathValuePairs)) {
+               if (\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValuesByPathValuePairs($pathValuePairs)) {
                        // Get the template part from the file
                        $template = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($templateFile, '###CONTINUE###');
                        // Get the subpart for messages
index e00d642..dfd9de7 100644 (file)
@@ -175,7 +175,7 @@ abstract class AbstractUpdate {
         * @return void
         */
        protected function markWizardAsDone($confValue = 1) {
-               \TYPO3\CMS\Core\Configuration\ConfigurationManager::setLocalConfigurationValueByPath('INSTALL/wizardDone/' . get_class($this), $confValue);
+               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath('INSTALL/wizardDone/' . get_class($this), $confValue);
        }
 
        /**
index 450b582..4f774ff 100644 (file)
@@ -62,10 +62,10 @@ class LanguageRepository {
         */
        public function __construct() {
                try {
-                       $globalSettings = \TYPO3\CMS\Core\Configuration\ConfigurationManager::getLocalConfigurationValueByPath($this->configurationPath);
+                       $globalSettings = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->getLocalConfigurationValueByPath($this->configurationPath);
                        $this->selectedLanguages = (array) $globalSettings['availableLanguages'];
                } catch (\Exception $e) {
-                       \TYPO3\CMS\Core\Configuration\ConfigurationManager::setLocalConfigurationValueByPath(
+                       \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath(
                                $this->configurationPath,
                                array('availableLanguages' => array())
                        );
@@ -167,7 +167,7 @@ class LanguageRepository {
                $dir = count($languages) - count($this->selectedLanguages);
                $diff = $dir < 0 ? array_diff($this->selectedLanguages, $languages) : array_diff($languages, $this->selectedLanguages);
 
-               \TYPO3\CMS\Core\Configuration\ConfigurationManager::setLocalConfigurationValueByPath(
+               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath(
                        $this->configurationPath,
                        array('availableLanguages' => $languages)
                );
index 9e5a0a1..e148f24 100644 (file)
@@ -86,9 +86,9 @@ class Autoloader {
                if (!\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('saltedpasswords')) {
                        \TYPO3\CMS\Core\Extension\ExtensionManager::loadExtension('saltedpasswords');
                }
-               \TYPO3\CMS\Core\Configuration\ConfigurationManager::setLocalConfigurationValueByPath('EXT/extConf/saltedpasswords', 'a:2:{s:3:"FE.";a:2:{s:7:"enabled";s:1:"1";s:21:"saltedPWHashingMethod";s:28:"tx_saltedpasswords_salts_md5";}s:3:"BE.";a:2:{s:7:"enabled";s:1:"1";s:21:"saltedPWHashingMethod";s:28:"tx_saltedpasswords_salts_md5";}}');
-               \TYPO3\CMS\Core\Configuration\ConfigurationManager::setLocalConfigurationValueByPath('BE/loginSecurityLevel', 'rsa');
-               \TYPO3\CMS\Core\Configuration\ConfigurationManager::setLocalConfigurationValueByPath('FE/loginSecurityLevel', 'rsa');
+               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath('EXT/extConf/saltedpasswords', 'a:2:{s:3:"FE.";a:2:{s:7:"enabled";s:1:"1";s:21:"saltedPWHashingMethod";s:28:"tx_saltedpasswords_salts_md5";}s:3:"BE.";a:2:{s:7:"enabled";s:1:"1";s:21:"saltedPWHashingMethod";s:28:"tx_saltedpasswords_salts_md5";}}');
+               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath('BE/loginSecurityLevel', 'rsa');
+               \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager')->setLocalConfigurationValueByPath('FE/loginSecurityLevel', 'rsa');
        }
 
 }