public function setUp() { parent::setUp(); $this->configurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager', array('isFeatureEnabled'), array(), '', FALSE); $this->configurationManager->expects($this->any())->method('isFeatureEnabled')->with('rewrittenPropertyMapper')->will($this->returnValue(TRUE)); $this->validator->injectConfigurationManager($this->configurationManager); }
/** * @return void */ public function setUp() { $this->mockValidatorResolver = $this->getAccessibleMock('TYPO3\\CMS\\Extbase\\Validation\\ValidatorResolver', array('createValidator', 'buildBaseValidatorConjunction', 'getBaseValidatorConjunction')); $this->validator = $this->getValidator(); $this->configurationManager = $this->getMock('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager', array('isFeatureEnabled'), array(), '', FALSE); $this->configurationManager->expects($this->any())->method('isFeatureEnabled')->with('rewrittenPropertyMapper')->will($this->returnValue(TRUE)); $this->validator->injectConfigurationManager($this->configurationManager); $this->validator->_set('validatorResolver', $this->mockValidatorResolver); }
/** * Removing system configuration by path * * Example: ./typo3cms configuration:removebypath DB,EXT/EXTCONF/realurl * * @param array $paths Path to system configuration that should be removed. Multiple paths can be specified separated by comma * @param bool $force If set, do not ask for confirmation */ public function removeByPathCommand(array $paths, $force = FALSE) { if (!$force) { do { $answer = strtolower($this->output->ask('Remove ' . implode(',', $paths) . ' from system configuration (TYPO3_CONF_VARS)? (y/N): ')); } while ($answer !== 'y' && $answer !== 'yes'); } $removed = $this->configurationManager->removeLocalConfigurationKeysByPath($paths); if (!$removed) { $this->outputLine('Paths seems invalid or empty. Nothing done!'); $this->sendAndExit(1); } $this->outputLine('Removed from system configuration'); }
/** * Check is preset is currently active on the system * * @return boolean TRUE if preset is active */ public function isActive() { $isActive = TRUE; foreach ($this->configurationValues as $configurationKey => $configurationValue) { try { $currentValue = $this->configurationManager->getConfigurationValueByPath($configurationKey); } catch (\RuntimeException $e) { $currentValue = NULL; } if ($currentValue !== $configurationValue) { $isActive = FALSE; break; } } return $isActive; }
/** * Detail configuration of Image Magick and Graphics Magick settings * depending on main values. * * "Configuration presets" in install tool is not type safe, so value * comparisons here are not type safe too, to not trigger changes to * LocalConfiguration again. * * @return void */ protected function setImageMagickDetailSettings() { $changedValues = array(); try { $currentIm5Value = $this->configurationManager->getLocalConfigurationValueByPath('GFX/im_version_5'); } catch (\RuntimeException $e) { $currentIm5Value = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/im_version_5'); } try { $currentImMaskValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/im_mask_temp_ext_gif'); } catch (\RuntimeException $e) { $currentImMaskValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/im_mask_temp_ext_gif'); } try { $currentIm5EffectsValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/im_v5effects'); } catch (\RuntimeException $e) { $currentIm5EffectsValue = $this->configurationManager->getDefaultConfigurationValueByPath('GFX/im_v5effects'); } if ((string) $currentIm5Value !== '') { if ($currentImMaskValue != 1) { $changedValues['GFX/im_mask_temp_ext_gif'] = 1; } if ($currentIm5Value === 'gm') { if ($currentIm5EffectsValue != -1) { $changedValues['GFX/im_v5effects'] = -1; } } } if (!empty($changedValues)) { $this->configurationManager->setLocalConfigurationValuesByPathValuePairs($changedValues); $this->throwRedirectException(); } }
/** * @param array $localconfValues * @return void */ private function writeLocalconfArray(array $localconfValues) { if (!$this->configurationManager instanceof ConfigurationManager) { $this->configurationManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager'); } $this->configurationManager->setLocalConfigurationValueByPath('EXT/extConf/snowbabel', serialize($localconfValues)); ExtensionManagementUtility::removeCacheFiles(); }
/** * @return array */ public function getValidCacheGroups() { $validGroups = array(); foreach ($this->configurationManager->getConfigurationValueByPath('SYS/caching/cacheConfigurations') as $cacheConfiguration) { if (isset($cacheConfiguration['groups']) && is_array($cacheConfiguration['groups'])) { $validGroups = array_merge($validGroups, $cacheConfiguration['groups']); } } return array_unique($validGroups); }
/** * Configure selected feature presets to be active * * @return \TYPO3\CMS\Install\Status\StatusInterface */ protected function activate() { $configurationValues = $this->featureManager->getConfigurationForSelectedFeaturePresets($this->postValues['values']); if (!empty($configurationValues)) { $this->configurationManager->setLocalConfigurationValuesByPathValuePairs($configurationValues); /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */ $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\OkStatus::class); $message->setTitle('Configuration written'); $messageBody = array(); foreach ($configurationValues as $configurationKey => $configurationValue) { $messageBody[] = '\'' . $configurationKey . '\' => \'' . $configurationValue . '\''; } $message->setMessage(implode(LF, $messageBody)); } else { /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */ $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\InfoStatus::class); $message->setTitle('No configuration change selected'); } return $message; }
/** * @test */ public function doNotSetImageMagickDetailSettings() { /** @var $silentConfigurationUpgradeServiceInstance SilentConfigurationUpgradeService|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\CMS\Core\Tests\AccessibleObjectInterface */ $silentConfigurationUpgradeServiceInstance = $this->getAccessibleMock(SilentConfigurationUpgradeService::class, array('dummy'), array(), '', false); $currentLocalConfiguration = array(array('GFX/processor', ''), array('GFX/processor_allowTemporaryMasksAsPng', 0), array('GFX/processor_effects', 0)); $this->createConfigurationManagerWithMockedMethods(array('getLocalConfigurationValueByPath', 'getDefaultConfigurationValueByPath', 'setLocalConfigurationValuesByPathValuePairs')); $this->configurationManager->expects($this->exactly(3))->method('getLocalConfigurationValueByPath')->will($this->returnValueMap($currentLocalConfiguration)); $this->configurationManager->expects($this->never())->method('getDefaultConfigurationValueByPath'); $this->configurationManager->expects($this->never())->method('setLocalConfigurationValuesByPathValuePairs'); $silentConfigurationUpgradeServiceInstance->_set('configurationManager', $this->configurationManager); $silentConfigurationUpgradeServiceInstance->_call('setImageMagickDetailSettings'); }
/** * Migrate old Install Tool Wizard "done"-settings to new class names * this happens usually when an existing 6.0/6.1 has called the TceformsUpdateWizard wizard * and has written Tx_Install_Updates_File_TceformsUpdateWizard in TYPO3's LocalConfiguration.php * * @return void */ protected function migrateOldInstallWizardDoneSettingsToNewClassNames() { $classNamesToConvert = array(); $localConfiguration = $this->configurationManager->getLocalConfiguration(); // check for wizards that have been run already and don't start with TYPO3... if (isset($localConfiguration['INSTALL']['wizardDone']) && is_array($localConfiguration['INSTALL']['wizardDone'])) { $classNames = array_keys($localConfiguration['INSTALL']['wizardDone']); foreach ($classNames as $className) { if (!GeneralUtility::isFirstPartOfStr($className, 'TYPO3')) { $classNamesToConvert[] = $className; } } } if (!count($classNamesToConvert)) { return; } $migratedClassesMapping = array('Tx_Install_Updates_File_TceformsUpdateWizard' => 'TYPO3\\CMS\\Install\\Updates\\TceformsUpdateWizard'); $migratedSettings = array(); $settingsToRemove = array(); foreach ($classNamesToConvert as $oldClassName) { if (isset($migratedClassesMapping[$oldClassName])) { $newClassName = $migratedClassesMapping[$oldClassName]; } else { continue; } $oldValue = NULL; $newValue = NULL; try { $oldValue = $this->configurationManager->getLocalConfigurationValueByPath('INSTALL/wizardDone/' . $oldClassName); } catch (\RuntimeException $e) { // The old configuration does not exist continue; } try { $newValue = $this->configurationManager->getLocalConfigurationValueByPath('INSTALL/wizardDone/' . $newClassName); } catch (\RuntimeException $e) { // The new configuration does not exist yet } if ($newValue === NULL) { // Migrate the old configuration to the new one $migratedSettings['INSTALL/wizardDone/' . $newClassName] = $oldValue; } $settingsToRemove[] = 'INSTALL/wizardDone/' . $oldClassName; } if (count($migratedSettings)) { $this->configurationManager->setLocalConfigurationValuesByPathValuePairs($migratedSettings); } $this->configurationManager->removeLocalConfigurationKeysByPath($settingsToRemove); if (count($migratedSettings) || count($settingsToRemove)) { $this->throwRedirectException(); } }
/** * Migrate the configuration setting BE/lockSSL to boolean if set in the LocalConfiguration.php file * * @return void */ protected function migrateLockSslSetting() { try { $currentOption = $this->configurationManager->getLocalConfigurationValueByPath('BE/lockSSL'); // check if the current option is an integer/string and if it is active if (!is_bool($currentOption) && (int) $currentOption > 0) { $this->configurationManager->setLocalConfigurationValueByPath('BE/lockSSL', true); $this->throwRedirectException(); } } catch (\RuntimeException $e) { // no change inside the LocalConfiguration.php found, so nothing needs to be modified } }
/** * Merge new configuration with existing configuration * * @param array $configuration the new configuration array * @param array $extension the extension information * @return array */ protected function mergeWithExistingConfiguration(array $configuration, array $extension) { try { $currentExtensionConfig = unserialize($this->configurationManager->getConfigurationValueByPath('EXT/extConf/' . $extension['key'])); } catch (\RuntimeException $e) { $currentExtensionConfig = array(); } $flatExtensionConfig = \TYPO3\CMS\Core\Utility\ArrayUtility::flatten($currentExtensionConfig); $valuedCurrentExtensionConfig = array(); foreach ($flatExtensionConfig as $key => $value) { $valuedCurrentExtensionConfig[$key]['value'] = $value; } $configuration = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($configuration, $valuedCurrentExtensionConfig); return $configuration; }
/** * Write the current configuration to localconf.php * This is needed for any sites that were relying on the former default * values which are going to change in TYPO3 4.5. * * @param array &$dbQueries: queries done in this update * @param mixed &$customMessages: custom messages * @return boolean whether the updated was made or not */ 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', ''); } // 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 ($result1 && $result2) { $customMessages[] = 'The configuration was successfully updated.'; return TRUE; } else { return FALSE; } }
/** * @test */ public function writeLocalConfigurationWritesSortedContentToConfigurationFile() { $configurationFile = PATH_site . 'typo3temp/var/tests/' . $this->getUniqueId('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($configurationFile)) { throw new \RuntimeException('File ' . $configurationFile . ' could not be found. Please check your write permissions', 1346364362); } $this->testFilesToDelete[] = $configurationFile; $this->subject->expects($this->any())->method('getLocalConfigurationFileLocation')->will($this->returnValue($configurationFile)); $pairs = array('foo' => 42, 'bar' => 23); $expectedContent = '<?php' . LF . 'return [' . LF . ' \'bar\' => 23,' . LF . ' \'foo\' => 42,' . LF . '];' . LF; $this->subject->writeLocalConfiguration($pairs); $this->assertSame($expectedContent, file_get_contents($configurationFile)); }
/** * Migrate the definition of the image processor from the configuration value * im_version_5 to the setting processor. * * @return void */ protected function migrateImageProcessorSetting() { $changedSettings = array(); $settingsToRename = array('GFX/im' => 'GFX/processor_enabled', 'GFX/im_version_5' => 'GFX/processor', 'GFX/im_v5effects' => 'GFX/processor_effects', 'GFX/im_path' => 'GFX/processor_path', 'GFX/im_path_lzw' => 'GFX/processor_path_lzw', 'GFX/im_mask_temp_ext_gif' => 'GFX/processor_allowTemporaryMasksAsPng', 'GFX/im_noScaleUp' => 'GFX/processor_allowUpscaling', 'GFX/im_noFramePrepended' => 'GFX/processor_allowFrameSelection', 'GFX/im_stripProfileCommand' => 'GFX/processor_stripColorProfileCommand', 'GFX/im_useStripProfileByDefault' => 'GFX/processor_stripColorProfileByDefault', 'GFX/colorspace' => 'GFX/processor_colorspace'); foreach ($settingsToRename as $oldPath => $newPath) { try { $value = $this->configurationManager->getLocalConfigurationValueByPath($oldPath); $this->configurationManager->setLocalConfigurationValueByPath($newPath, $value); $changedSettings[$oldPath] = true; } catch (\RuntimeException $e) { // If an exception is thrown, the value is not set in LocalConfiguration $changedSettings[$oldPath] = false; } } if (!empty($changedSettings['GFX/im_version_5'])) { $currentProcessorValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/im_version_5'); $newProcessorValue = $currentProcessorValue === 'gm' ? 'GraphicsMagick' : 'ImageMagick'; $this->configurationManager->setLocalConfigurationValueByPath('GFX/processor', $newProcessorValue); } if (!empty($changedSettings['GFX/im_noScaleUp'])) { $currentProcessorValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/im_noScaleUp'); $newProcessorValue = !$currentProcessorValue; $this->configurationManager->setLocalConfigurationValueByPath('GFX/processor_allowUpscaling', $newProcessorValue); } if (!empty($changedSettings['GFX/im_noFramePrepended'])) { $currentProcessorValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/im_noFramePrepended'); $newProcessorValue = !$currentProcessorValue; $this->configurationManager->setLocalConfigurationValueByPath('GFX/processor_allowFrameSelection', $newProcessorValue); } if (!empty($changedSettings['GFX/im_mask_temp_ext_gif'])) { $currentProcessorValue = $this->configurationManager->getLocalConfigurationValueByPath('GFX/im_mask_temp_ext_gif'); $newProcessorValue = !$currentProcessorValue; $this->configurationManager->setLocalConfigurationValueByPath('GFX/processor_allowTemporaryMasksAsPng', $newProcessorValue); } if (!empty(array_filter($changedSettings))) { $this->configurationManager->removeLocalConfigurationKeysByPath(array_keys($changedSettings)); $this->throwRedirectException(); } }
/** * Sets the database connection of the current Typo3 instance. */ private function setDatabaseConnection() { print_r($GLOBALS['TYPO3_DB']); print_r($GLOBALS['TYPO3_DB']->databaseHost); $this->databaseConnection = $this->configurationManager->getConfigurationValueByPath('DB'); }
/** * Activates saltedpasswords. * * @return void */ protected function activateSaltedPasswords() { if (!\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded('rsaauth')) { \TYPO3\CMS\Core\Extension\ExtensionManager::loadExtension('rsaauth'); } 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'); }
/** * Update selected languages * * @param array $languages * @return array */ public function updateSelectedLanguages($languages) { // Add possible dependencies for selected languages $dependencies = array(); foreach ($languages as $language) { $dependencies = array_merge($dependencies, $this->locales->getLocaleDependencies($language)); } if (count($dependencies)) { $languages = array_unique(array_merge($languages, $dependencies)); } $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($this->configurationPath, array('availableLanguages' => $languages)); return array('success' => count($diff) > 0, 'dir' => $dir, 'diff' => array_values($diff), 'languages' => $languages); }
/** * Writes the TSstyleconf values to "localconf.php" * Removes the temp_CACHED* files before return. * * @param string $extensionKey Extension key * @param array $newConfiguration Configuration array to write back * @return void */ public function writeExtensionTypoScriptStyleConfigurationToLocalconf($extensionKey, $newConfiguration) { \TYPO3\CMS\Core\Configuration\ConfigurationManager::setLocalConfigurationValueByPath('EXT/extConf/' . $extensionKey, serialize($newConfiguration)); \TYPO3\CMS\Core\Extension\ExtensionManager::removeCacheFiles(); }
/** * Performs the update itself * * @param array pointer where to insert all DB queries made, so they can be shown to the user if wanted * @param string pointer to output custom messages * @return boolean TRUE if update succeeded, FALSE otherwise * @todo Define visibility */ public function performUpdate(&$dbQueries, &$customMessages) { $customMessages = ''; // if we just set it to an older version if ($this->userInput['version']) { $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); $customMessages .= '<br />The compatibility version has been set to ' . $version . '.'; return 1; }
/** * Checks if frontend is available or not. * * @return boolean false if not. */ protected function shouldRun() { return (bool) $this->configurationManager->getLocalConfiguration('FE.pageUnavailable_force') === true; }
/** * Set new configuration values in LocalConfiguration.php * * @param array $pathValuePairs * @return void */ 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)) { // Get the template part from the file $template = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($templateFile, '###CONTINUE###'); // Get the subpart for messages $messagesSubPart = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($template, '###MESSAGES###'); $messages = array(); foreach ($this->messages as $message) { // Define the markers content $messagesMarkers['message'] = $message; // Fill the markers in the subpart $messages[] = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($messagesSubPart, $messagesMarkers, '###|###', TRUE, FALSE); } // Substitute the subpart for messages $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($template, '###MESSAGES###', implode(LF, $messages)); // Define the markers content $markers = array('header' => 'Writing configuration', 'action' => $this->action, 'label' => 'Click to continue...'); // Fill the markers $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($content, $markers, '###|###', TRUE, FALSE); $this->outputExitBasedOnStep($content); } else { // Get the template part from the file $template = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($templateFile, '###NOCHANGE###'); // Define the markers content $markers = array('header' => 'Writing configuration', 'message' => 'No values were changed, so nothing is updated!', 'action' => $this->action, 'label' => 'Click to continue...'); // Fill the markers $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($template, $markers, '###|###', TRUE, FALSE); $this->outputExitBasedOnStep($content); } }
/** * Writes extension list and clear cache files. * * @TODO : This method should be protected, but with current em it is hard to do so, * @param array Extension array to load, loader order is kept * @return void * @internal */ public static function writeNewExtensionList(array $newExtensionList) { $extensionList = array_unique($newExtensionList); \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)); static::removeCacheFiles(); }
/** * Initialize TSFE object * * @return void */ protected function initializeTsfe() { $configurationManager = new ConfigurationManager(); $GLOBALS['TYPO3_CONF_VARS'] = $configurationManager->getDefaultConfiguration(); $GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = '.*'; $GLOBALS['TYPO3_CONF_VARS']['FE']['ContentObjects'] = ['TEXT' => 'TYPO3\\CMS\\Frontend\\ContentObject\\TextContentObject', 'COA' => 'TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectArrayContentObject']; $GLOBALS['TT'] = new TimeTracker(); $GLOBALS['TSFE'] = new TypoScriptFrontendController($GLOBALS['TYPO3_CONF_VARS'], 1, 0, true); }
/** * Load default TYPO3_CONF_VARS to globals * * @return void */ protected static function loadDefaultConfiguration() { $GLOBALS['TYPO3_CONF_VARS'] = \TYPO3\CMS\Core\Configuration\ConfigurationManager::getDefaultConfiguration(); }
/** * Marks some wizard as being "seen" so that it not shown again. * * Writes the info in LocalConfiguration.php * * @param mixed $confValue The configuration is set to this value * @return void */ protected function markWizardAsDone($confValue = 1) { \TYPO3\CMS\Core\Configuration\ConfigurationManager::setLocalConfigurationValueByPath('INSTALL/wizardDone/' . get_class($this), $confValue); }
/** * Populate the local configuration. * Merge default TYPO3_CONF_VARS with content of typo3conf/LocalConfiguration.php, * execute typo3conf/AdditionalConfiguration.php, define database related constants. * * @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(\TYPO3\CMS\Core\Configuration\ConfigurationManager::LOCALCONF_FILE . ' not found!'); } define('TYPO3_user_agent', 'User-Agent: ' . $GLOBALS['TYPO3_CONF_VARS']['HTTP']['userAgent']); return $this; }