Project

General

Profile

Bug #18706 » 0008260_4-4.patch

Administrator Admin, 2010-09-03 15:39

View differences:

t3lib/class.t3lib_extmgm.php (Arbeitskopie)
public static function typo3_loadExtensions() {
global $TYPO3_CONF_VARS;
// Select mode how to load extensions in order to speed up the FE
if (TYPO3_MODE == 'FE') {
if (!($extLoadInContext = $TYPO3_CONF_VARS['EXT']['extList_FE'])) {
// fall back to standard 'extList' if 'extList_FE' is not (yet) set
$extLoadInContext = $TYPO3_CONF_VARS['EXT']['extList'];
}
$cacheFileSuffix = '_FE';
} else {
$extLoadInContext = $TYPO3_CONF_VARS['EXT']['extList'];
// Works as before
$cacheFileSuffix = '';
}
// Caching behaviour of ext_tables.php and ext_localconf.php files:
$extensionCacheBehaviour = self::getExtensionCacheBehaviour();
// Full list of extensions includes both required and extList:
$rawExtList = $TYPO3_CONF_VARS['EXT']['requiredExt'] . ',' . $extLoadInContext;
$rawExtList = self::getEnabledExtensionList();
// Empty array as a start.
$extensions = array();
......
//
if ($rawExtList) {
// The cached File prefix.
$cacheFilePrefix = 'temp_CACHED' . $cacheFileSuffix;
// Setting the name for the cache files:
if (intval($TYPO3_CONF_VARS['EXT']['extCache'])==1) $cacheFilePrefix.= '_ps'.substr(t3lib_div::shortMD5(PATH_site.'|'.$GLOBALS['TYPO_VERSION']), 0, 4);
if (intval($TYPO3_CONF_VARS['EXT']['extCache'])==2) $cacheFilePrefix.= '_'.t3lib_div::shortMD5($rawExtList);
$cacheFilePrefix = self::getCacheFilePrefix();
// If cache files available, set cache file prefix and return:
if ($TYPO3_CONF_VARS['EXT']['extCache'] && self::isCacheFilesAvailable($cacheFilePrefix)) {
if ($extensionCacheBehaviour && self::isCacheFilesAvailable($cacheFilePrefix)) {
// Return cache file prefix:
$extensions['_CACHEFILE'] = $cacheFilePrefix;
} else { // ... but if not, configure...
......
unset($extensions['_CACHEFILE']);
// write cache?
if ($TYPO3_CONF_VARS['EXT']['extCache'] &&
if ($extensionCacheBehaviour &&
@is_dir(PATH_typo3.'sysext/') &&
@is_dir(PATH_typo3.'ext/')) { // Must also find global and system extension directories to exist, otherwise caching cannot be allowed (since it is most likely a temporary server problem). This might fix a rare, unrepeatable bug where global/system extensions are not loaded resulting in fatal errors if that is cached!
$wrError = self::cannotCacheFilesWritable($cacheFilePrefix);
......
* Evaluation relies on $TYPO3_LOADED_EXT['_CACHEFILE']
* Usage: 2
*
* @param string $cacheFilePrefix Cache file prefix to be used (optional)
* @return array
* @internal
*/
public static function currentCacheFiles() {
if (($cacheFilePrefix = $GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'])) {
public static function currentCacheFiles($cacheFilePrefix = NULL) {
if (is_null($cacheFilePrefix)) {
$cacheFilePrefix = $GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'];
}
if ($cacheFilePrefix) {
$cacheFilePrefixFE = str_replace('temp_CACHED','temp_CACHED_FE',$cacheFilePrefix);
$files = array();
if (self::isCacheFilesAvailable($cacheFilePrefix)) {
......
/**
* Unlink (delete) cache files
*
* @param string $cacheFilePrefix Cache file prefix to be used (optional)
* @return integer Number of deleted files.
*/
public static function removeCacheFiles() {
$cacheFiles = self::currentCacheFiles();
public static function removeCacheFiles($cacheFilePrefix = NULL) {
$cacheFiles = self::currentCacheFiles($cacheFilePrefix);
$out = 0;
if (is_array($cacheFiles)) {
reset($cacheFiles);
......
}
return $out;
}
/**
* Gets the behaviour for caching ext_tables.php and ext_localconf.php files
* (see $TYPO3_CONF_VARS['EXT']['extCache'] setting in the install tool).
*
* @param boolean $usePlainValue Whether to use the value as it is without modifications
* @return integer
*/
public static function getExtensionCacheBehaviour($usePlainValue = FALSE) {
$extensionCacheBehaviour = intval($GLOBALS['TYPO3_CONF_VARS']['EXT']['extCache']);
// Caching of extensions is disabled when install tool is used:
if (!$usePlainValue && defined('TYPO3_enterInstallScript') && TYPO3_enterInstallScript) {
$extensionCacheBehaviour = 0;
}
return $extensionCacheBehaviour;
}
/**
* Gets the prefix used for the ext_tables.php and ext_localconf.php cached files.
*
* @return string
*/
public static function getCacheFilePrefix() {
$extensionCacheBehaviour = self::getExtensionCacheBehaviour(TRUE);
$cacheFileSuffix = (TYPO3_MODE == 'FE' ? '_FE' : '');
$cacheFilePrefix = 'temp_CACHED' . $cacheFileSuffix;
if ($extensionCacheBehaviour == 1) {
$cacheFilePrefix.= '_ps' . substr(t3lib_div::shortMD5(PATH_site . '|' . $GLOBALS['TYPO_VERSION']), 0, 4);
} elseif ($extensionCacheBehaviour == 2) {
$cacheFilePrefix.= '_' . t3lib_div::shortMD5(self::getEnabledExtensionList());
}
return $cacheFilePrefix;
}
/**
* Gets the list of enabled extensions for the accordant context (frontend or backend).
*
* @return string
*/
public static function getEnabledExtensionList() {
// Select mode how to load extensions in order to speed up the FE
if (TYPO3_MODE == 'FE') {
if (!($extLoadInContext = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList_FE'])) {
// fall back to standard 'extList' if 'extList_FE' is not (yet) set
$extLoadInContext = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'];
}
} else {
$extLoadInContext = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'];
}
$extensionList = $GLOBALS['TYPO3_CONF_VARS']['EXT']['requiredExt'] . ',' . $extLoadInContext;
return $extensionList;
}
}
?>
typo3/sysext/install/mod/class.tx_install.php (Arbeitskopie)
* @return void
*/
function updateWizard() {
global $TYPO3_CONF_VARS;
// clear cache files
t3lib_extMgm::removeCacheFiles();
t3lib_extMgm::removeCacheFiles(t3lib_extMgm::getCacheFilePrefix());
// generate new cache files and include them
$GLOBALS['TYPO3_CONF_VARS']['EXT']['extCache'] = 1;
$TYPO3_LOADED_EXT = t3lib_extMgm::typo3_loadExtensions();
if ($TYPO3_LOADED_EXT['_CACHEFILE']) {
require(PATH_typo3conf . $TYPO3_LOADED_EXT['_CACHEFILE'] . '_ext_localconf.php');
}
// call wizard
$action = ($this->INSTALL['database_type'] ? $this->INSTALL['database_type'] : 'checkForUpdate');
$this->updateWizard_parts($action);
(4-4/5)