Skip to content
Snippets Groups Projects
Commit 721fe2aa authored by Helmut Hummel's avatar Helmut Hummel Committed by Oliver Hader
Browse files

[!!!][TASK] Load extension configuration in function context

Until now all the ext_localconf.php files provided by extensions 
were included in a global scope. This is a major blocker for
a clean and flexible bootstrapping.

Include the configuration files in a method of the bootstrap class 
and set all supported global variables as global.

Resolves: #38124
Releases: 6.0
Change-Id: I4e7136d39f85258f75f6f76cb60eeede8bfc0453
Reviewed-on: http://review.typo3.org/12139
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
parent 564a5a75
Branches
Tags
No related merge requests found
......@@ -42,23 +42,8 @@ Typo3_Bootstrap_Backend::getInstance()
->registerSwiftMailer()
->configureExceptionHandling()
->setMemoryLimit()
->defineTypo3RequestTypes();
// Load extensions:
$TYPO3_LOADED_EXT = t3lib_extMgm::typo3_loadExtensions();
if ($TYPO3_LOADED_EXT['_CACHEFILE']) {
require(PATH_typo3conf . $TYPO3_LOADED_EXT['_CACHEFILE'] . '_ext_localconf.php');
} else {
$temp_TYPO3_LOADED_EXT = $TYPO3_LOADED_EXT;
foreach ($temp_TYPO3_LOADED_EXT as $_EXTKEY => $temp_lEDat) {
if (is_array($temp_lEDat) && $temp_lEDat['ext_localconf.php']) {
$_EXTCONF = $TYPO3_CONF_VARS['EXT']['extConf'][$_EXTKEY];
require($temp_lEDat['ext_localconf.php']);
}
}
}
Typo3_Bootstrap_Backend::getInstance()
->defineTypo3RequestTypes()
->loadAdditionalConfigurationFromExtensions()
->deprecationLogForOldXclassRegistration()
->initializeExceptionHandling()
->requireAdditionalExtensionFiles()
......
......@@ -746,6 +746,49 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract {
return $this;
}
/**
* Load extension configuration files (ext_localconf.php)
*
* The ext_localconf.php files in extensions are meant to make changes
* to the global $TYPO3_CONF_VARS configuration array.
*
* @return Typo3_Bootstrap_Backend
*/
public function loadAdditionalConfigurationFromExtensions() {
// This is the main array meant to be manipulated in the ext_localconf.php files
// In general it is recommended to not rely on it to be globally defined in that
// scope but to use $GLOBALS['TYPO3_CONF_VARS'] instead.
// Nevertheless we define it here as global for backwards compatibility.
global $TYPO3_CONF_VARS;
// These globals for internal use only. Manipulating them directly is highly discouraged!
// We set them here as global for backwards compatibility, but this will change in
// future versions.
// @deprecated since 6.0 Will be removed in two versions.
global $T3_SERVICES, $T3_VAR;
// Load extensions:
$GLOBALS['TYPO3_LOADED_EXT'] = t3lib_extMgm::typo3_loadExtensions();
// Load temp_CACHED file of ext_tables or each ext_tables.php of loaded extensions
if ($GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE']
&& file_exists(PATH_typo3conf . $GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'] . '_ext_localconf.php')
) {
require(PATH_typo3conf . $GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'] . '_ext_localconf.php');
} else {
foreach ($GLOBALS['TYPO3_LOADED_EXT'] as $_EXTKEY => $extensionInformation) {
if (is_array($extensionInformation) && $extensionInformation['ext_localconf.php']) {
// $_EXTKEY and $_EXTCONF are available in ext_localconf.php
// and are explicitly set in temp_CACHED file as well
$_EXTCONF = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY];
require($extensionInformation['ext_localconf.php']);
}
}
}
return $this;
}
/**
* Write deprecation log if the TYPO3 instance uses deprecated XCLASS
* registrations via $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']
......@@ -1386,4 +1429,4 @@ class Typo3_Bootstrap_Backend extends Typo3_Bootstrap_Abstract {
}
}
}
?>
\ No newline at end of file
?>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment