Project

General

Profile

Bug #18706 » 0008260_4-2.patch

Administrator Admin, 2010-09-03 15:38

View differences:

t3lib/class.t3lib_extmgm.php (Arbeitskopie)
public static function typo3_loadExtensions() {
global $TYPO3_CONF_VARS;
// 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'].','.$TYPO3_CONF_VARS['EXT']['extList'];
$rawExtList = self::getEnabledExtensionList();
// Empty array as a start.
$extensions = array();
......
//
if ($rawExtList) {
// The cached File prefix.
$cacheFilePrefix = 'temp_CACHED';
// 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'] && t3lib_extMgm::isCacheFilesAvailable($cacheFilePrefix)) {
if ($extensionCacheBehaviour && t3lib_extMgm::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 = t3lib_extMgm::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() {
global $TYPO3_LOADED_EXT;
public static function currentCacheFiles($cacheFilePrefix = NULL) {
if (is_null($cacheFilePrefix)) {
$cacheFilePrefix = $GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'];
}
if ($TYPO3_LOADED_EXT['_CACHEFILE']) {
if (t3lib_extMgm::isCacheFilesAvailable($TYPO3_LOADED_EXT['_CACHEFILE'])) {
if ($cacheFilePrefix) {
if (t3lib_extMgm::isCacheFilesAvailable($cacheFilePrefix)) {
return array(
PATH_typo3conf.$TYPO3_LOADED_EXT['_CACHEFILE'].'_ext_localconf.php',
PATH_typo3conf.$TYPO3_LOADED_EXT['_CACHEFILE'].'_ext_tables.php'
PATH_typo3conf . $cacheFilePrefix . '_ext_localconf.php',
PATH_typo3conf . $cacheFilePrefix . '_ext_tables.php'
);
}
}
......
/**
* 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 = t3lib_extMgm::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);
$cacheFilePrefix = 'temp_CACHED';
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.
*
* @return string
*/
public static function getEnabledExtensionList() {
$extensionList = $GLOBALS['TYPO3_CONF_VARS']['EXT']['requiredExt'] . ',' . $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'];
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);
(2-2/5)