/**
  * @test
  * @expectedException \RuntimeException
  */
 public function getLocalConfigurationExecutesDefinedConfigurationFile()
 {
     $configurationFile = PATH_site . 'typo3temp/var/tests/' . $this->getUniqueId('localConfiguration');
     file_put_contents($configurationFile, '<?php throw new \\RuntimeException(\'foo\', 1310203815); ?>');
     $this->testFilesToDelete[] = $configurationFile;
     $this->subject->expects($this->once())->method('getLocalConfigurationFileLocation')->will($this->returnValue($configurationFile));
     $this->subject->getLocalConfiguration();
 }
 /**
  * Reload Cache files and Typo3LoadedExtensions
  *
  * @return void
  */
 public function reloadCaches()
 {
     \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::removeCacheFiles();
     // Set new extlist / extlistArray for extension load changes at runtime
     $localConfiguration = $this->configurationManager->getLocalConfiguration();
     $GLOBALS['TYPO3_CONF_VARS']['EXT']['extListArray'] = $localConfiguration['EXT']['extListArray'];
     $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'] = implode(',', $GLOBALS['TYPO3_CONF_VARS']['EXT']['extListArray']);
     \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadTypo3LoadedExtAndExtLocalconf(FALSE);
 }
 /**
  * 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();
     }
 }
Example #4
0
 /**
  * Reload Cache files and Typo3LoadedExtensions
  *
  * @return void
  */
 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();
     $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);
 }
Example #5
0
 /**
  * Checks if frontend is available or not.
  *
  * @return boolean     false if not.
  */
 protected function shouldRun()
 {
     return (bool) $this->configurationManager->getLocalConfiguration('FE.pageUnavailable_force') === true;
 }
Example #6
0
 /**
  * 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;
 }