[!!!][TASK] Move temp_CACHED_* files to caching framework
authorChristian Kuhn <lolli@schwarzbu.ch>
Sun, 24 Jun 2012 17:09:00 +0000 (19:09 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 28 Jun 2012 20:12:15 +0000 (22:12 +0200)
After the basic bootstrap refactoring that moved the loading of
ext_tables.php and ext_localconf.php to class context, it is now easily
possible to put the former temp_CACHED_* files to the caching framework
as cached PHP code, next to the autoloader registry cache entry.

This patch introduces a new API to t3lib_extMgm to handle the
loading of ext_localconf, ext_tables and the global TYPO3_LOADED_EXT
array and removes the current handling that was cluttered throughout
the core.

The setting of TYPO3_CONF_VARS['SYS']['extCache'] is now deprecated and
unused. The bootstrap now decides based on its context, whether caching
of those files is used. This way we can for example run the install tool
in a fully uncached environment and can get rid of the nasty side effects
we had in this area in the past.

With a simple call to t3lib_extMgm::removeCacheFiles() all cache entries
in PHP code cache that are tagged with 'core' can be removed at once.
This currently affects the autoloader registry, the TYPO3_LOADED_EXT
entry, and the concatenated ext_localconf and ext_tables files.

The patch furthermore gets rid of the _CACHEFILE array key in
$GLOBALS['TYPO3_LOADED_EXT'] that worked as a kind of API to the calling
method to indicate if a concatenated ext_tables and ext_localconf file
is available.

Change-Id: Id00be5f24ec1698ed9126e61b229a718d6ca6741
Resolves: #38414
Releases: 6.0
Reviewed-on: http://review.typo3.org/12383
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
26 files changed:
t3lib/class.t3lib_autoloader.php
t3lib/class.t3lib_extmgm.php
t3lib/class.t3lib_tcemain.php
t3lib/extjs/class.t3lib_extjs_extdirectapi.php
t3lib/stddb/DefaultSettings.php
t3lib/stddb/tables.php
tests/Unit/t3lib/class.t3lib_autoloaderTest.php
tests/Unit/t3lib/class.t3lib_extmgmTest.php
typo3/classes/Bootstrap.php
typo3/classes/class.clearcachemenu.php
typo3/cli_dispatch.phpsh
typo3/init.php
typo3/install/index.php
typo3/sysext/aboutmodules/class.tx_aboutmodules_functions.php
typo3/sysext/cms/tslib/class.tslib_fe.php
typo3/sysext/cms/tslib/index_ts.php
typo3/sysext/em/classes/extensions/class.tx_em_extensions_list.php
typo3/sysext/em/classes/install/class.tx_em_install.php
typo3/sysext/em/classes/tools/class.tx_em_tools.php
typo3/sysext/em/classes/translations/class.tx_em_translations.php
typo3/sysext/impexp/app/index.php
typo3/sysext/install/mod/class.tx_install.php
typo3/sysext/install/updates/class.tx_coreupdates_migrateworkspaces.php
typo3/sysext/install/updates/class.tx_coreupdates_t3skin.php
typo3/sysext/lang/locallang_csh_corebe.xlf
typo3/sysext/saltedpasswords/classes/class.tx_saltedpasswords_autoloader.php

index e8b5aa5..0023ac1 100644 (file)
@@ -370,7 +370,7 @@ class t3lib_autoloader {
                $GLOBALS['typo3CacheManager']->getCache('cache_phpcode')->set(
                        self::getAutoloadCacheIdentifier(),
                        $cachedFileContent,
-                       array('t3lib_autoloader')
+                       array('t3lib_autoloader', 'core')
                );
        }
 
index 008a4ca..269a9b1 100644 (file)
  * @package TYPO3
  * @subpackage t3lib
  */
-final class t3lib_extMgm {
+class t3lib_extMgm {
 
        protected static $extensionKeyMap;
 
+       /**
+        * TRUE, if ext_tables file was read from cache for this script run.
+        * The frontend tends to do that multiple times, but the caching framework does
+        * not allow this (via a require_once call). This variable is used to track
+        * the access to the cache file to read the single ext_tables.php if it was
+        * already read from cache
+        *
+        * @TODO: See if we can get rid of the 'load multiple times' scenario in fe
+        * @var boolean
+        */
+       protected static $extTablesWasReadFromCacheOnce = FALSE;
+
        /**************************************
         *
         * PATHS and other evaluation
@@ -1507,92 +1519,363 @@ tt_content.' . $key . $prefix . ' {
                }
        }
 
-       /**************************************
+       /***************************************
         *
-        *       INTERNAL EXTENSION MANAGEMENT:
+        * Internal extension management methods
         *
         ***************************************/
 
        /**
-        * Loading extensions configured in $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList']
+        * Load the extension information array. This array is set as
+        * $GLOBALS['TYPO3_LOADED_EXT'] in bootstrap. It contains basic information
+        * about every loaded extension.
         *
-        * CACHING ON: ($GLOBALS['TYPO3_CONF_VARS']['EXT']['extCache'] = 1)
-        *               If caching is enabled (and possible), the output will be $extensions['_CACHEFILE'] set to the cacheFilePrefix. Subsequently the cache files must be included then since those will eventually set up the extensions.
-        *               If cachefiles are not found they will be generated
-        * CACHING OFF: ($GLOBALS['TYPO3_CONF_VARS']['EXT']['extCache'] = 0)
-        *               The returned value will be an array where each key is an extension key and the value is an array with filepaths for the extension.
-        *               This array will later be set in the global var $GLOBALS['TYPO3_LOADED_EXT']
+        * This is an internal method. It is only used during bootstrap and
+        * extensions should not use it!
         *
-        * Usages of this function can be seen in bootstrap
-        * Extensions are always detected in the order local - global - system.
-        *
-        * @return array Extension Array
-        * @internal
+        * @param boolean $allowCaching If FALSE, the array will not be read / created from cache
+        * @return array Result array that will be set as $GLOBALS['TYPO3_LOADED_EXT']
+        * @access private
+        * @createTypo3LoadedExtensionInformationArray
         */
-       public static function typo3_loadExtensions() {
+       public static function loadTypo3LoadedExtensionInformation($allowCaching = TRUE) {
+               if ($allowCaching) {
+                       $cacheIdentifier = self::getTypo3LoadedExtensionInformationCacheIdentifier();
+                       /** @var $phpCodeCache t3lib_cache_frontend_PhpFrontend */
+                       $phpCodeCache = $GLOBALS['typo3CacheManager']->getCache('cache_phpcode');
+                       if ($phpCodeCache->has($cacheIdentifier)) {
+                               $typo3LoadedExtensionArray = $phpCodeCache->requireOnce($cacheIdentifier);
+                       } else {
+                               $typo3LoadedExtensionArray = self::createTypo3LoadedExtensionInformationArray();
+                               $phpCodeCache->set(
+                                       $cacheIdentifier,
+                                       'return ' . var_export($typo3LoadedExtensionArray, TRUE) . ';',
+                                       array('typo3LoadedExtensionArray', 'core')
+                               );
+                       }
+               } else {
+                       $typo3LoadedExtensionArray = self::createTypo3LoadedExtensionInformationArray();
+               }
 
-                       // Caching behaviour of ext_tables.php and ext_localconf.php files:
-               $extensionCacheBehaviour = self::getExtensionCacheBehaviour();
-                       // Full list of extensions includes both required and extList:
-               $rawExtList = self::getEnabledExtensionList();
-
-                       // Empty array as a start.
-               $extensions = array();
-
-                       //
-               if ($rawExtList) {
-                               // The cached File prefix.
-                       $cacheFilePrefix = self::getCacheFilePrefix();
-
-                               // If cache files available, set cache file prefix and return:
-                       if ($extensionCacheBehaviour && self::isCacheFilesAvailable($cacheFilePrefix)) {
-                                       // Return cache file prefix:
-                               $extensions['_CACHEFILE'] = $cacheFilePrefix;
-                       } else { // ... but if not, configure...
-
-                                       // Prepare reserved filenames:
-                               $files = array('ext_localconf.php', 'ext_tables.php', 'ext_tables.sql', 'ext_tables_static+adt.sql', 'ext_typoscript_constants.txt', 'ext_typoscript_setup.txt');
-                                       // Traverse extensions and check their existence:
-                               clearstatcache(); // Clear file state cache to make sure we get good results from is_dir()
-                               $temp_extensions = array_unique(t3lib_div::trimExplode(',', $rawExtList, 1));
-                               foreach ($temp_extensions as $temp_extKey) {
-                                               // Check local, global and system locations:
-                                       if (@is_dir(PATH_typo3conf . 'ext/' . $temp_extKey . '/')) {
-                                               $extensions[$temp_extKey] = array('type' => 'L', 'siteRelPath' => 'typo3conf/ext/' . $temp_extKey . '/', 'typo3RelPath' => '../typo3conf/ext/' . $temp_extKey . '/');
-                                       } elseif (@is_dir(PATH_typo3 . 'ext/' . $temp_extKey . '/')) {
-                                               $extensions[$temp_extKey] = array('type' => 'G', 'siteRelPath' => TYPO3_mainDir . 'ext/' . $temp_extKey . '/', 'typo3RelPath' => 'ext/' . $temp_extKey . '/');
-                                       } elseif (@is_dir(PATH_typo3 . 'sysext/' . $temp_extKey . '/')) {
-                                               $extensions[$temp_extKey] = array('type' => 'S', 'siteRelPath' => TYPO3_mainDir . 'sysext/' . $temp_extKey . '/', 'typo3RelPath' => 'sysext/' . $temp_extKey . '/');
-                                       }
+               return $typo3LoadedExtensionArray;
+       }
 
-                                               // If extension was found, check for reserved filenames:
-                                       if (isset($extensions[$temp_extKey])) {
-                                               foreach ($files as $fName) {
-                                                       $temp_filename = PATH_site . $extensions[$temp_extKey]['siteRelPath'] . trim($fName);
-                                                       if (is_array($extensions[$temp_extKey]) && @is_file($temp_filename)) {
-                                                               $extensions[$temp_extKey][$fName] = $temp_filename;
-                                                       }
-                                               }
-                                       }
-                               }
-                               unset($extensions['_CACHEFILE']);
-
-                                       // Write cache?
-                               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);
-                                       if ($wrError) {
-                                               $GLOBALS['TYPO3_CONF_VARS']['EXT']['extCache'] = 0;
-                                       } else {
-                                                       // Write cache files:
-                                               $extensions = self::writeCacheFiles($extensions, $cacheFilePrefix);
+       /**
+        * Set up array with basic information about loaded extension:
+        *
+        * array(
+        *              'extensionKey' => array(
+        *                      'type' => Either S, L or G, inidicating if the extension is a system, a local or a global extension
+        *                      'siteRelPath' => Relative path to the extension from document root
+        *                      'typo3RelPath' => Relative path to extension from typo3/ subdirectory
+        *                      'ext_localconf.php' => Absolute path to ext_localconf.php file of extension
+        *                      'ext_...' => Further absolute path of extension files, see $extensionFilesToCheckFor var for details
+        *              ),
+        * );
+        *
+        * @return array Result array that will be set as $GLOBALS['TYPO3_LOADED_EXT']
+        */
+       protected static function createTypo3LoadedExtensionInformationArray() {
+               $loadedExtensions = array_unique(t3lib_div::trimExplode(',', self::getEnabledExtensionList(), 1));
+               $loadedExtensionInformation = array();
+
+               $extensionFilesToCheckFor = array(
+                       'ext_localconf.php',
+                       'ext_tables.php',
+                       'ext_tables.sql',
+                       'ext_tables_static+adt.sql',
+                       'ext_typoscript_constants.txt',
+                       'ext_typoscript_setup.txt'
+               );
+
+                       // Clear file status cache to make sure we get good results from is_dir()
+               clearstatcache();
+
+               foreach ($loadedExtensions as $extensionKey) {
+                               // Determine if extension is installed locally, globally or system (in this order)
+                       if (@is_dir(PATH_typo3conf . 'ext/' . $extensionKey . '/')) {
+                                       // local
+                               $loadedExtensionInformation[$extensionKey] = array(
+                                       'type' => 'L',
+                                       'siteRelPath' => 'typo3conf/ext/' . $extensionKey . '/',
+                                       'typo3RelPath' => '../typo3conf/ext/' . $extensionKey . '/'
+                               );
+                       } elseif (@is_dir(PATH_typo3 . 'ext/' . $extensionKey . '/')) {
+                                       // global
+                               $loadedExtensionInformation[$extensionKey] = array(
+                                       'type' => 'G',
+                                       'siteRelPath' => TYPO3_mainDir . 'ext/' . $extensionKey . '/',
+                                       'typo3RelPath' => 'ext/' . $extensionKey . '/'
+                               );
+                       } elseif (@is_dir(PATH_typo3 . 'sysext/' . $extensionKey . '/')) {
+                                       // system
+                               $loadedExtensionInformation[$extensionKey] = array(
+                                       'type' => 'S',
+                                       'siteRelPath' => TYPO3_mainDir . 'sysext/' . $extensionKey . '/',
+                                       'typo3RelPath' => 'sysext/' . $extensionKey . '/'
+                               );
+                       }
+
+                               // Register found files in extension array if extension was found
+                       if (isset($loadedExtensionInformation[$extensionKey])) {
+                               foreach ($extensionFilesToCheckFor as $fileName) {
+                                       $absolutePathToFile = PATH_site . $loadedExtensionInformation[$extensionKey]['siteRelPath'] . $fileName;
+                                       if (@is_file($absolutePathToFile)) {
+                                               $loadedExtensionInformation[$extensionKey][$fileName] = $absolutePathToFile;
                                        }
                                }
                        }
                }
 
-               return $extensions;
+               return $loadedExtensionInformation;
+       }
+
+       /**
+        * Cache identifier of cached Typo3LoadedExtensionInformation array
+        *
+        * @return string
+        */
+       protected static function getTypo3LoadedExtensionInformationCacheIdentifier() {
+               return sha1(TYPO3_version . PATH_site . 'loadedExtensions');
+       }
+
+       /**
+        * Execute all ext_localconf.php files of loaded extensions.
+        * The method implements an optionally used caching mechanism that concatenates all
+        * ext_localconf.php files in one file.
+        *
+        * This is an internal method. It is only used during bootstrap and
+        * extensions should not use it!
+        *
+        * @param boolean $allowCaching Whether or not to load / create concatenated cache file
+        * @return void
+        * @access private
+        */
+       public static function loadExtLocalconf($allowCaching = TRUE) {
+               if ($allowCaching) {
+                       $cacheIdentifier = self::getExtLocalconfCacheIdentifier();
+                       /** @var $phpCodeCache t3lib_cache_frontend_PhpFrontend */
+                       $phpCodeCache = $GLOBALS['typo3CacheManager']->getCache('cache_phpcode');
+                       if ($phpCodeCache->has($cacheIdentifier)) {
+                               $phpCodeCache->requireOnce($cacheIdentifier);
+                       } else {
+                               self::loadSingleExtLocalconfFiles();
+                               self::createExtLocalconfCacheEntry();
+                       }
+               } else {
+                       self::loadSingleExtLocalconfFiles();
+               }
+       }
+
+       /**
+        * Execute ext_localconf.php files from extensions
+        *
+        * @return void
+        */
+       protected static function loadSingleExtLocalconfFiles() {
+                       // 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;
+
+               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 cached file as well
+                               $_EXTCONF = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY];
+                               require($extensionInformation['ext_localconf.php']);
+                       }
+               }
+       }
+
+       /**
+        * Create cache entry for concatenated ext_localconf.php files
+        *
+        * @return void
+        */
+       protected static function createExtLocalconfCacheEntry() {
+               $extensionInformation = $GLOBALS['TYPO3_LOADED_EXT'];
+               $phpCodeToCache = array();
+
+                       // Set same globals as in loadSingleExtLocalconfFiles()
+               $phpCodeToCache[] = '/**';
+               $phpCodeToCache[] = ' * Compiled ext_localconf.php cache file';
+               $phpCodeToCache[] = ' */';
+               $phpCodeToCache[] = '';
+               $phpCodeToCache[] = 'global $TYPO3_CONF_VARS, $T3_SERVICES, $T3_VAR;';
+               $phpCodeToCache[] = '';
+
+                       // Iterate through loaded extensions and add ext_localconf content
+               foreach ($extensionInformation as $extensionKey => $extensionDetails) {
+                               // Include a header per extension to make the cache file more readable
+                       $phpCodeToCache[] = '/**';
+                       $phpCodeToCache[] = ' * Extension: ' . $extensionKey;
+                       $phpCodeToCache[] = ' * File: ' . $extensionDetails['ext_localconf.php'];
+                       $phpCodeToCache[] = ' */';
+                       $phpCodeToCache[] = '';
+
+                               // Set $_EXTKEY and $_EXTCONF for this extension
+                       $phpCodeToCache[] = '$_EXTKEY = \'' . $extensionKey . '\';';
+                       $phpCodeToCache[] = '$_EXTCONF = $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXT\'][\'extConf\'][$_EXTKEY];';
+                       $phpCodeToCache[] = '';
+
+                               // Add ext_localconf.php content of extension
+                       $phpCodeToCache[] = trim(t3lib_div::getUrl($extensionDetails['ext_localconf.php']));
+                       $phpCodeToCache[] = '';
+                       $phpCodeToCache[] = '';
+               }
+
+               $phpCodeToCache = implode(LF, $phpCodeToCache);
+                       // Remove all start and ending php tags from content
+               $phpCodeToCache = preg_replace('/<\?php|\?>/is', '', $phpCodeToCache);
+
+               $GLOBALS['typo3CacheManager']->getCache('cache_phpcode')->set(
+                       self::getExtLocalconfCacheIdentifier(),
+                       $phpCodeToCache,
+                       array('concatenatedExtLocalconf', 'core')
+               );
+       }
+
+       /**
+        * Cache identifier of concatenated ext_localconf file
+        *
+        * @return string
+        */
+       protected static function getExtLocalconfCacheIdentifier() {
+               return sha1(TYPO3_version . PATH_site . 'extLocalconf');
+       }
+
+       /**
+        * Execute all ext_tables.php files of loaded extensions.
+        * The method implements an optionally used caching mechanism that concatenates all
+        * ext_tables.php files in one file.
+        *
+        * This is an internal method. It is only used during bootstrap and
+        * extensions should not use it!
+        *
+        * @param boolean $allowCaching Whether to load / create concatenated cache file
+        * @return void
+        * @access private
+        */
+       public static function loadExtTables($allowCaching = TRUE) {
+               if ($allowCaching && !self::$extTablesWasReadFromCacheOnce) {
+                       self::$extTablesWasReadFromCacheOnce = TRUE;
+                       $cacheIdentifier = self::getExtTablesCacheIdentifier();
+                       /** @var $phpCodeCache t3lib_cache_frontend_PhpFrontend */
+                       $phpCodeCache = $GLOBALS['typo3CacheManager']->getCache('cache_phpcode');
+                       if ($phpCodeCache->has($cacheIdentifier)) {
+                               $phpCodeCache->requireOnce($cacheIdentifier);
+                       } else {
+                               self::loadSingleExtTablesFiles();
+                               self::createExtTablesCacheEntry();
+                       }
+               } else {
+                       self::loadSingleExtTablesFiles();
+               }
+       }
+
+       /**
+        * Load ext_tables.php as single files
+        *
+        * @return void
+        */
+       protected static function loadSingleExtTablesFiles() {
+                       // In general it is recommended to not rely on it to be globally defined in that
+                       // scope, but we can not prohibit this without breaking backwards compatibility
+               global $T3_SERVICES, $T3_VAR, $TYPO3_CONF_VARS;
+               global $TBE_MODULES, $TBE_MODULES_EXT, $TCA;
+               global $PAGES_TYPES, $TBE_STYLES, $FILEICONS;
+
+                       // Load each ext_tables.php file of loaded extensions
+               foreach ($GLOBALS['TYPO3_LOADED_EXT'] as $_EXTKEY => $extensionInformation) {
+                       if (is_array($extensionInformation) && $extensionInformation['ext_tables.php']) {
+                                       // $_EXTKEY and $_EXTCONF are available in ext_tables.php
+                                       // and are explicitly set in cached file as well
+                               $_EXTCONF = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY];
+                               require($extensionInformation['ext_tables.php']);
+                       }
+               }
+       }
+
+       /**
+        * Create concatenated ext_tables.php cache file
+        *
+        * @return void
+        */
+       protected static function createExtTablesCacheEntry() {
+               $extensionInformation = $GLOBALS['TYPO3_LOADED_EXT'];
+               $phpCodeToCache = array();
+
+                       // Set same globals as in loadSingleExtTablesFiles()
+               $phpCodeToCache[] = '/**';
+               $phpCodeToCache[] = ' * Compiled ext_tables.php cache file';
+               $phpCodeToCache[] = ' */';
+               $phpCodeToCache[] = '';
+               $phpCodeToCache[] = 'global $T3_SERVICES, $T3_VAR, $TYPO3_CONF_VARS;';
+               $phpCodeToCache[] = 'global $TBE_MODULES, $TBE_MODULES_EXT, $TCA;';
+               $phpCodeToCache[] = 'global $PAGES_TYPES, $TBE_STYLES, $FILEICONS;';
+               $phpCodeToCache[] = '';
+
+                       // Iterate through loaded extensions and add ext_tables content
+               foreach ($extensionInformation as $extensionKey => $extensionDetails) {
+                               // Include a header per extension to make the cache file more readable
+                       $phpCodeToCache[] = '/**';
+                       $phpCodeToCache[] = ' * Extension: ' . $extensionKey;
+                       $phpCodeToCache[] = ' * File: ' . $extensionDetails['ext_tables.php'];
+                       $phpCodeToCache[] = ' */';
+                       $phpCodeToCache[] = '';
+
+                               // Set $_EXTKEY and $_EXTCONF for this extension
+                       $phpCodeToCache[] = '$_EXTKEY = \'' . $extensionKey . '\';';
+                       $phpCodeToCache[] = '$_EXTCONF = $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXT\'][\'extConf\'][$_EXTKEY];';
+                       $phpCodeToCache[] = '';
+
+                               // Add ext_tables.php content of extension
+                       $phpCodeToCache[] = trim(t3lib_div::getUrl($extensionDetails['ext_tables.php']));
+                       $phpCodeToCache[] = '';
+                       $phpCodeToCache[] = '';
+               }
+
+               $phpCodeToCache = implode(LF, $phpCodeToCache);
+                       // Remove all start and ending php tags from content
+               $phpCodeToCache = preg_replace('/<\?php|\?>/is', '', $phpCodeToCache);
+
+               $GLOBALS['typo3CacheManager']->getCache('cache_phpcode')->set(
+                       self::getExtTablesCacheIdentifier(),
+                       $phpCodeToCache,
+                       array('combinedExtTables', 'core')
+               );
+       }
+
+       /**
+        * Cache identifier for concatenated ext_tables.php files
+        *
+        * @return string
+        */
+       protected static function getExtTablesCacheIdentifier() {
+               return sha1(TYPO3_version . PATH_site . 'extTables');
+       }
+
+       /**
+        * Loading extensions configured in $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList']
+        *
+        * Usages of this function can be seen in bootstrap
+        * Extensions are always detected in the order local - global - system.
+        *
+        * @return array Extension Array
+        * @internal
+        * @deprecated since 6.0, will be removed in two versions
+        */
+       public static function typo3_loadExtensions() {
+               t3lib_div::logDeprecatedFunction();
+               return self::loadTypo3LoadedExtensionInformation(TRUE);
        }
 
        /**
@@ -1602,32 +1885,24 @@ tt_content.' . $key . $prefix . ' {
         * @param string $file Is the filename (only informative for comment)
         * @return string
         * @internal
+        * @deprecated since 6.0, will be removed in two versions
         */
        public static function _makeIncludeHeader($key, $file) {
-               return '<?php
-###########################
-## EXTENSION: ' . $key . '
-## FILE:      ' . $file . '
-###########################
-
-$_EXTKEY = \'' . $key . '\';
-$_EXTCONF = $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXT\'][\'extConf\'][$_EXTKEY];
-
-?>';
+               t3lib_div::logDeprecatedFunction();
+               return '';
        }
 
        /**
-        * Returns TRUE if both the localconf and tables cache file exists (with $cacheFilePrefix) and if they are not empty
+        * Returns TRUE if both the localconf and tables cache file exists
+        * (with $cacheFilePrefix) and if they are not empty
         *
         * @param $cacheFilePrefix string Prefix of the cache file to check
         * @return boolean
+        * @deprecated since 6.0, will be removed in two versions
         */
        public static function isCacheFilesAvailable($cacheFilePrefix) {
-               return
-                       @is_file(PATH_typo3conf . $cacheFilePrefix . '_ext_localconf.php') &&
-                               @is_file(PATH_typo3conf . $cacheFilePrefix . '_ext_tables.php') &&
-                               @filesize(PATH_typo3conf . $cacheFilePrefix . '_ext_localconf.php') > 0 &&
-                               @filesize(PATH_typo3conf . $cacheFilePrefix . '_ext_tables.php') > 0;
+               t3lib_div::logDeprecatedFunction();
+               return FALSE;
        }
 
        /**
@@ -1647,51 +1922,26 @@ $_EXTCONF = $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXT\'][\'extConf\'][$_EXTKEY];
         * @param string $cacheFilePrefix Prefix of the cache file to check
         * @return string
         * @internal
+        * @deprecated since 6.0, will be removed in two versions
         */
        public static function cannotCacheFilesWritable($cacheFilePrefix) {
-               $error = array();
-               if (!@is_writable(PATH_typo3conf)) {
-                       $error[] = PATH_typo3conf;
-               }
-               if (@is_file(PATH_typo3conf . $cacheFilePrefix . '_ext_localconf.php') &&
-                               !@is_writable(PATH_typo3conf . $cacheFilePrefix . '_ext_localconf.php')) {
-                       $error[] = PATH_typo3conf . $cacheFilePrefix . '_ext_localconf.php';
-               }
-               if (@is_file(PATH_typo3conf . $cacheFilePrefix . '_ext_tables.php') &&
-                               !@is_writable(PATH_typo3conf . $cacheFilePrefix . '_ext_tables.php')) {
-                       $error[] = PATH_typo3conf . $cacheFilePrefix . '_ext_tables.php';
-               }
-               return implode(', ', $error);
+               t3lib_div::logDeprecatedFunction();
+               return '';
        }
 
        /**
-        * Returns an array with the two cache-files (0=>localconf, 1=>tables) from typo3conf/ if they (both) exist. Otherwise FALSE.
+        * Returns an array with the two cache-files (0=>localconf, 1=>tables)
+        * from typo3conf/ if they (both) exist. Otherwise FALSE.
         * Evaluation relies on $GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE']
         *
         * @param string $cacheFilePrefix Cache file prefix to be used (optional)
         * @return array
         * @internal
+        * @deprecated since 6.0, will be removed in versions
         */
        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)) {
-                               $files[] = PATH_typo3conf . $cacheFilePrefix . '_ext_localconf.php';
-                               $files[] = PATH_typo3conf . $cacheFilePrefix . '_ext_tables.php';
-                       }
-                       if (self::isCacheFilesAvailable($cacheFilePrefixFE)) {
-                               $files[] = PATH_typo3conf . $cacheFilePrefixFE . '_ext_localconf.php';
-                               $files[] = PATH_typo3conf . $cacheFilePrefixFE . '_ext_tables.php';
-                       }
-                       if (!empty($files)) {
-                               return $files;
-                       }
-               }
+               t3lib_div::logDeprecatedFunction();
+               return array();
        }
 
        /**
@@ -1702,60 +1952,32 @@ $_EXTCONF = $GLOBALS[\'TYPO3_CONF_VARS\'][\'EXT\'][\'extConf\'][$_EXTKEY];
         * @param string $cacheFilePrefix Prefix for the cache files
         * @return array
         * @internal
+        * @deprecated since 6.0, will be removed in two versions
         */
        public static function writeCacheFiles($extensions, $cacheFilePrefix) {
-                       // Making cache files:
-               $extensions['_CACHEFILE'] = $cacheFilePrefix;
-               $cFiles = array();
-               $cFiles['ext_localconf'] .= '<?php
-
-$GLOBALS[\'TYPO3_LOADED_EXT\'] = unserialize(stripslashes(\'' . addslashes(serialize($extensions)) . '\'));
-
-?>';
-
-               foreach ($extensions as $key => $conf) {
-                       if (is_array($conf)) {
-                               if ($conf['ext_localconf.php']) {
-                                       $cFiles['ext_localconf'] .= self::_makeIncludeHeader($key, $conf['ext_localconf.php']);
-                                       $cFiles['ext_localconf'] .= trim(t3lib_div::getUrl($conf['ext_localconf.php']));
-                               }
-                               if ($conf['ext_tables.php']) {
-                                       $cFiles['ext_tables'] .= self::_makeIncludeHeader($key, $conf['ext_tables.php']);
-                                       $cFiles['ext_tables'] .= trim(t3lib_div::getUrl($conf['ext_tables.php']));
-                               }
-                       }
-               }
-
-               $cFiles['ext_localconf'] = "<?php\n" . preg_replace('/<\?php|\?>/is', '', $cFiles['ext_localconf']) . "?>\n";
-               $cFiles['ext_tables'] = "<?php\n" . preg_replace('/<\?php|\?>/is', '', $cFiles['ext_tables']) . "?>\n";
-
-               t3lib_div::writeFile(PATH_typo3conf . $cacheFilePrefix . '_ext_localconf.php', $cFiles['ext_localconf']);
-               t3lib_div::writeFile(PATH_typo3conf . $cacheFilePrefix . '_ext_tables.php', $cFiles['ext_tables']);
-
-               $extensions = array();
-               $extensions['_CACHEFILE'] = $cacheFilePrefix;
-
-               return $extensions;
+               t3lib_div::logDeprecatedFunction();
+               return array();
        }
 
        /**
-        * Unlink (delete) cache files
+        * Remove cache files from php code cache, tagged with 'core'
         *
-        * @param string $cacheFilePrefix Cache file prefix to be used (optional)
-        * @return integer Number of deleted files.
+        * This removes the following cache entries:
+        *      - autoloader cache registry
+        *      - cache loaded extension array
+        *      - ext_localconf concatenation
+        *      - ext_tables concatenation
+        *
+        * This method is usually only used by extension that fiddle
+        * with the loaded extensions. An example is the extension
+        * manager and the install tool.
+        *
+        * @return void
         */
-       public static function removeCacheFiles($cacheFilePrefix = NULL) {
-               $cacheFiles = self::currentCacheFiles($cacheFilePrefix);
-
-               $out = 0;
-               if (is_array($cacheFiles)) {
-                       foreach ($cacheFiles as $cfile) {
-                               @unlink($cfile);
-                               clearstatcache();
-                               $out++;
-                       }
-               }
-               return $out;
+       public static function removeCacheFiles() {
+               /** @var $phpCodeCache t3lib_cache_frontend_PhpFrontend */
+               $phpCodeCache = $GLOBALS['typo3CacheManager']->getCache('cache_phpcode');
+               $phpCodeCache->flushByTag('core');
        }
 
        /**
@@ -1764,16 +1986,11 @@ $GLOBALS[\'TYPO3_LOADED_EXT\'] = unserialize(stripslashes(\'' . addslashes(seria
         *
         * @param boolean $usePlainValue Whether to use the value as it is without modifications
         * @return integer
+        * @deprecated since 6.0, will be removed in two versions
         */
        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;
+               t3lib_div::logDeprecatedFunction();
+               return 1;
        }
 
        /**
@@ -1782,17 +1999,11 @@ $GLOBALS[\'TYPO3_LOADED_EXT\'] = unserialize(stripslashes(\'' . addslashes(seria
         * @return string
         */
        public static function getCacheFilePrefix() {
-               $extensionCacheBehaviour = self::getExtensionCacheBehaviour(TRUE);
-
-               if ($extensionCacheBehaviour) {
-                       $cacheFilePrefix = 'temp_CACHED_ps' . substr(t3lib_div::shortMD5(PATH_site . '|' . TYPO3_version), 0, 4);
-               }
-
-               return $cacheFilePrefix;
+               t3lib_div::logDeprecatedFunction();
        }
 
        /**
-        * Gets the list of enabled extensions for the accordant context (frontend or backend).
+        * Gets the list of enabled extensions
         *
         * @return string
         */
index 4199ea8..71b1506 100644 (file)
@@ -6417,11 +6417,13 @@ class t3lib_TCEmain {
        }
 
        /**
-        * Unlink (delete) typo3conf/temp_CACHED_*.php cache files
+        * Unlink (delete) core cache files
         *
         * @return integer The number of files deleted
+        * @deprecated since 6.0, will be removed in two versions, use t3lib_extMgm::removeCacheFiles() instead
         */
        function removeCacheFiles() {
+               t3lib_div::logDeprecatedFunction();
                return t3lib_extMgm::removeCacheFiles();
        }
 
@@ -6958,14 +6960,10 @@ class t3lib_TCEmain {
                                                }
                                        }
                                }
-                               if ($this->admin && $GLOBALS['TYPO3_CONF_VARS']['EXT']['extCache']) {
-                                       $this->removeCacheFiles();
-                               }
+                               t3lib_extMgm::removeCacheFiles();
                                break;
                        case 'temp_cached':
-                               if ($this->admin && $GLOBALS['TYPO3_CONF_VARS']['EXT']['extCache']) {
-                                       $this->removeCacheFiles();
-                               }
+                               t3lib_extMgm::removeCacheFiles();
                                break;
                }
 
@@ -7371,4 +7369,4 @@ class t3lib_TCEmain {
                return $elements;
        }
 }
-?>
\ No newline at end of file
+?>
index 6a7c7fe..bc69a70 100644 (file)
@@ -176,12 +176,7 @@ class t3lib_extjs_ExtDirectApi {
         * @return string $javascriptNamespaces
         */
        protected function getExtDirectApi(array $filterNamespaces) {
-                       // Check GET-parameter no_cache and extCache setting
-               $noCache = isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['extCache']) && (
-                               $GLOBALS['TYPO3_CONF_VARS']['SYS']['extCache'] === 0 ||
-                               $GLOBALS['TYPO3_CONF_VARS']['SYS']['extCache'] === '0'
-               );
-               $noCache = t3lib_div::_GET('no_cache') ? TRUE : $noCache;
+               $noCache = t3lib_div::_GET('no_cache') ? TRUE : FALSE;
 
                        // Look up into the cache
                $cacheIdentifier = 'ExtDirectApi';
index bb7c798..893635c 100644 (file)
@@ -202,7 +202,7 @@ return array(
                'requiredExt' => '',            // String. List of additional extensions which are REQUIRED and cannot be unloaded by the Extension Manager!
                'ignoredExt' => '',                     // String. List of extensions to be ignored (not loaded), e.g. "em" can be disabled this way.
                'excludeForPackaging' => '(CVS|\..*|.*~|.*\.bak)',              // String: List of directories and files which will not be packaged into extensions nor taken into account otherwise by the Extension Manager. Perl regular expression syntax!
-               'extCache' => 1,                                                // <p>Integer (0, 1)</p><dl><dt>0</dt><dd>ext-scripts (ext_localconf.php and ext_tables.php) are NOT cached, but included every time</dd><dt>1</dt><dd>scripts cached to typo3conf/temp_CACHED_[sitePathHash]* (saves some milliseconds even with PHP accelerators)</dd></dl>
+               'extCache' => -1,                                               // Deprecated and unused. Do not set anymore and remove from localconf.php
                'extList' => 'filelist,version,tsconfig_help,context_help,extra_page_cm_options,impexp,belog,about,cshmanual,aboutmodules,setup,opendocs,install,t3editor,felogin,feedit,recycler',                                             // String (exclude) List of extensions which are enabled for this install. Use the Extension Manager (EM) to manage this!
                'extConf' => array(                                             // Config-options for extensions, stored as serialized arrays by extension-keys. Handled automatically by the EM.
 //                     '--key--' => array()
index 0395956..9892a60 100644 (file)
@@ -40,9 +40,8 @@
  * (see references):
  * 1) First this script is included.
  * This should initialize the variables shown above.
- * 2) Then either the "typo3conf/temp_CACHED_??????_ext_tables.php" cache file
- * OR "stddb/load_ext_tables.php" is included in order to let extensions
- * add/modify these variables as they desire.
+ * 2) Then either the concatenated ext_tables.php cache file of all extensions
+ * is loaded, or each ext_tables.php file of active extensions.
  * 3) Finally if the constant "TYPO3_extTableDef_script" defines a file name
  * from typo3conf/ it is included, also for overriding values (the old-school
  * way before extensions came in). See bootstrap loadExtensionTables()
index 7fdcbdd..de59fcb 100644 (file)
@@ -121,16 +121,18 @@ class t3lib_autoloaderTest extends Tx_Phpunit_TestCase {
        /**
         * @test
         */
-       public function unregisterAutoloaderSetsCacheEntryWithT3libAutoloaderTag() {
+       public function unregisterAutoloaderSetsCacheEntryWithT3libAutoloaderAndCoreTag() {
                $mockCache = $this->getMock('t3lib_cache_frontend_AbstractFrontend', array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag', 'requireOnce'), array(), '', FALSE);
                        // Expect the mock cache set method to be called
                        // once with t3lib_autoloader as third parameter
-               $mockCache->expects($this->once())->method('set')->with($this->anything(), $this->anything(), array('t3lib_autoloader'));
+               $mockCache->expects($this->once())->method('set')
+                       ->with($this->anything(), $this->anything(), array('t3lib_autoloader', 'core'));
                $GLOBALS['typo3CacheManager'] = $this->getMock('t3lib_cache_Manager', array('getCache'));
                $GLOBALS['typo3CacheManager']->expects($this->any())->method('getCache')->will($this->returnValue($mockCache));
                t3lib_autoloader::unregisterAutoloader();
        }
 
+
        /**
         * @test
         */
index f6f7f83..bb2e2a7 100644 (file)
@@ -57,10 +57,20 @@ class t3lib_extmgmTest extends tx_phpunit_testcase {
         */
        protected $globals = array();
 
+       /**
+        * Absolute path to files that must be removed
+        * after a test - handled in tearDown
+        *
+        * @TODO: Check if the tests can use vfs:// instead
+        */
+       protected $testFilesToDelete = array();
+
        public function setUp() {
+               $this->createAccessibleProxyClass();
                $this->globals = array(
                        'TYPO3_LOADED_EXT' => serialize($GLOBALS['TYPO3_LOADED_EXT']),
                );
+               $this->testFilesToDelete = array();
        }
 
        public function tearDown() {
@@ -69,8 +79,54 @@ class t3lib_extmgmTest extends tx_phpunit_testcase {
                foreach ($this->globals as $key => $value) {
                        $GLOBALS[$key] = unserialize($value);
                }
+
+               foreach ($this->testFilesToDelete as $absoluteFileName) {
+                       t3lib_div::unlink_tempfile($absoluteFileName);
+               }
        }
 
+       /**
+        * Create a subclass with protected methods made public
+        *
+        * @return void
+        */
+       protected function createAccessibleProxyClass() {
+               $className = 't3lib_extMgmAccessibleProxy';
+               if (!class_exists($className, FALSE)) {
+                       eval(
+                               'class ' . $className . ' extends t3lib_extMgm {' .
+                               '  public static function createTypo3LoadedExtensionInformationArray() {' .
+                               '    return parent::createTypo3LoadedExtensionInformationArray();' .
+                               '  }' .
+                               '  public static function getTypo3LoadedExtensionInformationCacheIdentifier() {' .
+                               '    return parent::getTypo3LoadedExtensionInformationCacheIdentifier();' .
+                               '  }' .
+                               '  public static function getExtLocalconfCacheIdentifier() {' .
+                               '    return parent::getExtLocalconfCacheIdentifier();' .
+                               '  }' .
+                               '  public static function loadSingleExtLocalconfFiles() {' .
+                               '    return parent::loadSingleExtLocalconfFiles();' .
+                               '  }' .
+                                       // Additional method allows to manipulate $extTablesWasReadFromCacheOnce
+                                       // for test loadExtTablesRequiresCacheFileIfExistsAndCachingIsAllowed
+                               '  public static function resetExtTablesWasReadFromCacheOnceBoolean() {' .
+                               '    self::$extTablesWasReadFromCacheOnce = FALSE;' .
+                               '  }' .
+                               '  public static function createExtLocalconfCacheEntry() {' .
+                               '    return parent::createExtLocalconfCacheEntry();' .
+                               '  }' .
+                               '  public static function createExtTablesCacheEntry() {' .
+                               '    return parent::createExtTablesCacheEntry();' .
+                               '  }' .
+                               '  public static function getExtTablesCacheIdentifier() {' .
+                               '    return parent::getExtTablesCacheIdentifier();' .
+                               '  }' .
+                               '}'
+                       );
+               }
+       }
+
+
        ///////////////////////////////
        // Tests concerning extPath
        ///////////////////////////////
@@ -661,6 +717,293 @@ class t3lib_extmgmTest extends tx_phpunit_testcase {
                $this->assertEquals($expectedResultArray, $GLOBALS['TCA']['testTable']['columns']['testField']['config']['items']);
        }
 
+       /////////////////////////////////////////
+       // Tests concerning loadTypo3LoadedExtensionInformation
+       /////////////////////////////////////////
+
+       /**
+        * @test
+        */
+       public function loadTypo3LoadedExtensionInformationDoesNotCallCacheIfCachingIsDenied() {
+               $GLOBALS['typo3CacheManager'] = $this->getMock('t3lib_cache_Manager', array('getCache'));
+               $GLOBALS['typo3CacheManager']->expects($this->never())->method('getCache');
+               t3lib_extMgm::loadTypo3LoadedExtensionInformation(FALSE);
+       }
+
+       /**
+        * @test
+        */
+       public function loadTypo3LoadedExtensionInformationRequiresCacheFileIfExistsAndCachingIsAllowed() {
+               $mockCache = $this->getMock('t3lib_cache_frontend_AbstractFrontend', array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag', 'requireOnce'), array(), '', FALSE);
+               $GLOBALS['typo3CacheManager'] = $this->getMock('t3lib_cache_Manager', array('getCache'));
+               $GLOBALS['typo3CacheManager']->expects($this->any())->method('getCache')->will($this->returnValue($mockCache));
+               $mockCache->expects($this->any())->method('has')->will($this->returnValue(TRUE));
+               $mockCache->expects($this->once())->method('requireOnce');
+               t3lib_extMgm::loadTypo3LoadedExtensionInformation(TRUE);
+       }
+
+       /**
+        * @test
+        */
+       public function loadTypo3LoadedExtensionInformationSetsNewCacheEntryIfCacheFileDoesNotExistAndCachingIsAllowed() {
+               $mockCache = $this->getMock('t3lib_cache_frontend_AbstractFrontend', array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag', 'requireOnce'), array(), '', FALSE);
+               $GLOBALS['typo3CacheManager'] = $this->getMock('t3lib_cache_Manager', array('getCache'));
+               $GLOBALS['typo3CacheManager']->expects($this->any())->method('getCache')->will($this->returnValue($mockCache));
+               $mockCache->expects($this->any())->method('has')->will($this->returnValue(FALSE));
+               $mockCache->expects($this->once())->method('set');
+               t3lib_extMgm::loadTypo3LoadedExtensionInformation(TRUE);
+       }
+
+       /**
+        * @test
+        */
+       public function loadTypo3LoadedExtensionInformationSetsNewCacheEntryTaggedWithTypo3LoadedExtensionArrayAndCore() {
+               $mockCache = $this->getMock('t3lib_cache_frontend_AbstractFrontend', array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag', 'requireOnce'), array(), '', FALSE);
+               $GLOBALS['typo3CacheManager'] = $this->getMock('t3lib_cache_Manager', array('getCache'));
+               $GLOBALS['typo3CacheManager']->expects($this->any())->method('getCache')->will($this->returnValue($mockCache));
+               $mockCache->expects($this->any())->method('has')->will($this->returnValue(FALSE));
+               $mockCache->expects($this->once())->method('set')
+                       ->with($this->anything(), $this->anything(), $this->equalTo(array('typo3LoadedExtensionArray', 'core')));
+               t3lib_extMgm::loadTypo3LoadedExtensionInformation(TRUE);
+       }
+
+       /////////////////////////////////////////
+       // Tests concerning createTypo3LoadedExtensionInformationArray
+       /////////////////////////////////////////
+
+       /**
+        * Data provider for createTypo3LoadedExtensionInformationArrayReturnsExpectedInformationForCmsExtension
+        *
+        * @return array
+        */
+       public function createTypo3LoadedExtensionInformationArrayReturnsExpectedInformationForCmsExtensionDataProvider() {
+               return array(
+                       'System extension' => array('type', 'S'),
+                       'Site relative path' => array('siteRelPath', 'typo3/sysext/cms/'),
+                       'Typo3 relative path' => array('typo3RelPath', 'sysext/cms/'),
+                       'Path ext_localconf.php' => array('ext_localconf.php', '/typo3/sysext/cms/ext_localconf.php'),
+                       'Path ext_tables.php' => array('ext_tables.php', '/typo3/sysext/cms/ext_tables.php'),
+                       'Path ext_tablps.sql' => array('ext_tables.sql', '/typo3/sysext/cms/ext_tables.sql'),
+               );
+       }
+
+       /**
+        * @param string $arrayKeyToTest
+        * @param string $expectedContent
+        * @test
+        * @dataProvider createTypo3LoadedExtensionInformationArrayReturnsExpectedInformationForCmsExtensionDataProvider
+        */
+       public function createTypo3LoadedExtensionInformationArrayReturnsExpectedInformationForCmsExtension(
+               $arrayKeyToTest,
+               $expectedContent
+       ) {
+               $actualArray = t3lib_extMgmAccessibleProxy::createTypo3LoadedExtensionInformationArray();
+               $this->assertStringEndsWith($expectedContent, $actualArray['cms'][$arrayKeyToTest]);
+       }
+
+       /////////////////////////////////////////
+       // Tests concerning getTypo3LoadedExtensionInformationCacheIdentifier
+       /////////////////////////////////////////
+
+       /**
+        * @test
+        */
+       public function getTypo3LoadedExtensionInformationCacheIdentifierCreatesSha1WithFourtyCharacters() {
+               $sha1 = t3lib_extMgmAccessibleProxy::getTypo3LoadedExtensionInformationCacheIdentifier();
+               $this->assertEquals(40, strlen($sha1));
+       }
+
+       /////////////////////////////////////////
+       // Tests concerning loadExtLocalconf
+       /////////////////////////////////////////
+
+       /**
+        * @test
+        */
+       public function loadExtLocalconfDoesNotReadFromCacheIfCachingIsDenied() {
+               $GLOBALS['typo3CacheManager'] = $this->getMock('t3lib_cache_Manager', array('getCache'));
+               $GLOBALS['typo3CacheManager']->expects($this->never())->method('getCache');
+               t3lib_extMgm::loadExtLocalconf(FALSE);
+       }
+
+       /**
+        * @test
+        */
+       public function loadExtLocalconfRequiresCacheFileIfExistsAndCachingIsAllowed() {
+               $mockCache = $this->getMock('t3lib_cache_frontend_AbstractFrontend', array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag', 'requireOnce'), array(), '', FALSE);
+               $GLOBALS['typo3CacheManager'] = $this->getMock('t3lib_cache_Manager', array('getCache'));
+               $GLOBALS['typo3CacheManager']->expects($this->any())->method('getCache')->will($this->returnValue($mockCache));
+               $mockCache->expects($this->any())->method('has')->will($this->returnValue(TRUE));
+               $mockCache->expects($this->once())->method('requireOnce');
+               t3lib_extMgm::loadExtLocalconf(TRUE);
+       }
+
+       /////////////////////////////////////////
+       // Tests concerning loadSingleExtLocalconfFiles
+       /////////////////////////////////////////
+
+       /**
+        * @test
+        * @expectedException RuntimeException
+        */
+       public function loadSingleExtLocalconfFilesRequiresExtLocalconfFileRegisteredInGlobalTypo3LoadedExt() {
+               $extensionName = uniqid('foo');
+               $extLocalconfLocation = PATH_site . 'typo3temp/' . uniqid('test_ext_localconf') . '.php';
+               $this->testFilesToDelete[] = $extLocalconfLocation;
+               file_put_contents($extLocalconfLocation, "<?php\n\nthrow new RuntimeException('', 1340559079);\n\n?>");
+               $GLOBALS['TYPO3_LOADED_EXT'] = array(
+                       $extensionName => array(
+                               'ext_localconf.php' => $extLocalconfLocation,
+                       ),
+               );
+               t3lib_extMgmAccessibleProxy::loadSingleExtLocalconfFiles();
+       }
+
+       /////////////////////////////////////////
+       // Tests concerning createExtLocalconfCacheEntry
+       /////////////////////////////////////////
+
+       /**
+        * @test
+        */
+       public function createExtLocalconfCacheEntryWritesCacheEntryWithContentOfLoadedExtensionExtLocalconf() {
+               $extensionName = uniqid('foo');
+               $extLocalconfLocation = PATH_site . 'typo3temp/' . uniqid('test_ext_localconf') . '.php';
+               $this->testFilesToDelete[] = $extLocalconfLocation;
+               $uniqueStringInLocalconf = uniqid('foo');
+               file_put_contents($extLocalconfLocation, "<?php\n\n" . $uniqueStringInLocalconf . "\n\n?>");
+               $GLOBALS['TYPO3_LOADED_EXT'] = array(
+                       $extensionName => array(
+                               'ext_localconf.php' => $extLocalconfLocation,
+                       ),
+               );
+               $mockCache = $this->getMock('t3lib_cache_frontend_AbstractFrontend', array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag', 'requireOnce'), array(), '', FALSE);
+               $GLOBALS['typo3CacheManager'] = $this->getMock('t3lib_cache_Manager', array('getCache'));
+               $GLOBALS['typo3CacheManager']->expects($this->any())->method('getCache')->will($this->returnValue($mockCache));
+               $mockCache->expects($this->once())->method('set')
+                       ->with($this->anything(), $this->stringContains($uniqueStringInLocalconf), $this->anything());
+               t3lib_extMgmAccessibleProxy::createExtLocalconfCacheEntry();
+       }
+
+       /**
+        * @test
+        */
+       public function createExtLocalconfCacheEntryWritesCacheEntryTaggedWithCore() {
+               $mockCache = $this->getMock('t3lib_cache_frontend_AbstractFrontend', array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag', 'requireOnce'), array(), '', FALSE);
+               $GLOBALS['typo3CacheManager'] = $this->getMock('t3lib_cache_Manager', array('getCache'));
+               $GLOBALS['typo3CacheManager']->expects($this->any())->method('getCache')->will($this->returnValue($mockCache));
+               $mockCache->expects($this->once())->method('set')
+                       ->with($this->anything(), $this->anything(), $this->equalTo(array('concatenatedExtLocalconf', 'core')));
+               t3lib_extMgmAccessibleProxy::createExtLocalconfCacheEntry();
+       }
+
+       /////////////////////////////////////////
+       // Tests concerning getExtLocalconfCacheIdentifier
+       /////////////////////////////////////////
+
+       /**
+        * @test
+        */
+       public function getExtLocalconfCacheIdentifierCreatesSha1WithFourtyCharacters() {
+               $sha1 = t3lib_extMgmAccessibleProxy::getExtLocalconfCacheIdentifier();
+               $this->assertEquals(40, strlen($sha1));
+       }
+
+       /////////////////////////////////////////
+       // Tests concerning loadExtTables
+       /////////////////////////////////////////
+
+       /**
+        * @test
+        */
+       public function loadExtTablesDoesNotReadFromCacheIfCachingIsDenied() {
+               $GLOBALS['typo3CacheManager'] = $this->getMock('t3lib_cache_Manager', array('getCache'));
+               $GLOBALS['typo3CacheManager']->expects($this->never())->method('getCache');
+               t3lib_extMgm::loadExtLocalconf(FALSE);
+       }
+
+       /**
+        * @test
+        */
+       public function loadExtTablesRequiresCacheFileIfExistsAndCachingIsAllowed() {
+               $mockCache = $this->getMock('t3lib_cache_frontend_AbstractFrontend', array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag', 'requireOnce'), array(), '', FALSE);
+               $GLOBALS['typo3CacheManager'] = $this->getMock('t3lib_cache_Manager', array('getCache'));
+               $GLOBALS['typo3CacheManager']->expects($this->any())->method('getCache')->will($this->returnValue($mockCache));
+               $mockCache->expects($this->any())->method('has')->will($this->returnValue(TRUE));
+               $mockCache->expects($this->once())->method('requireOnce');
+
+                       // Reset the internal cache access tracking variable of extMgm
+                       // This method is only in the ProxyClass!
+               t3lib_extMgmAccessibleProxy::resetExtTablesWasReadFromCacheOnceBoolean();
+
+               t3lib_extMgm::loadExtTables(TRUE);
+       }
+
+
+       /////////////////////////////////////////
+       // Tests concerning createExtTablesCacheEntry
+       /////////////////////////////////////////
+
+       /**
+        * @test
+        */
+       public function createExtTablesCacheEntryWritesCacheEntryWithContentOfLoadedExtensionExtTables() {
+               $extensionName = uniqid('foo');
+               $extTablesLocation = PATH_site . 'typo3temp/' . uniqid('test_ext_tables') . '.php';
+               $this->testFilesToDelete[] = $extTablesLocation;
+               $uniqueStringInTables = uniqid('foo');
+               file_put_contents($extTablesLocation, "<?php\n\n" . $uniqueStringInTables . "\n\n?>");
+               $GLOBALS['TYPO3_LOADED_EXT'] = array(
+                       $extensionName => array(
+                               'ext_tables.php' => $extTablesLocation,
+                       ),
+               );
+               $mockCache = $this->getMock('t3lib_cache_frontend_AbstractFrontend', array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag', 'requireOnce'), array(), '', FALSE);
+               $GLOBALS['typo3CacheManager'] = $this->getMock('t3lib_cache_Manager', array('getCache'));
+               $GLOBALS['typo3CacheManager']->expects($this->any())->method('getCache')->will($this->returnValue($mockCache));
+               $mockCache->expects($this->once())->method('set')
+                       ->with($this->anything(), $this->stringContains($uniqueStringInTables), $this->anything());
+               t3lib_extMgmAccessibleProxy::createExtTablesCacheEntry();
+       }
+
+       /**
+        * @test
+        */
+       public function createExtTablesCacheEntryWritesCacheEntryTaggedWithCore() {
+               $mockCache = $this->getMock('t3lib_cache_frontend_AbstractFrontend', array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag', 'requireOnce'), array(), '', FALSE);
+               $GLOBALS['typo3CacheManager'] = $this->getMock('t3lib_cache_Manager', array('getCache'));
+               $GLOBALS['typo3CacheManager']->expects($this->any())->method('getCache')->will($this->returnValue($mockCache));
+               $mockCache->expects($this->once())->method('set')
+                       ->with($this->anything(), $this->anything(), $this->equalTo(array('combinedExtTables', 'core')));
+               t3lib_extMgmAccessibleProxy::createExtTablesCacheEntry();
+       }
+
+       /////////////////////////////////////////
+       // Tests concerning getExtTablesCacheIdentifier
+       /////////////////////////////////////////
+
+       /**
+        * @test
+        */
+       public function getExtTablesCacheIdentifierCreatesSha1WithFourtyCharacters() {
+               $sha1 = t3lib_extMgmAccessibleProxy::getExtTablesCacheIdentifier();
+               $this->assertEquals(40, strlen($sha1));
+       }
+
+       /////////////////////////////////////////
+       // Tests concerning removeCacheFiles
+       /////////////////////////////////////////
+
+       /**
+        * @test
+        */
+       public function removeCacheFilesRemovesCacheEntriesTaggedWithCore() {
+               $mockCache = $this->getMock('t3lib_cache_frontend_AbstractFrontend', array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag', 'requireOnce'), array(), '', FALSE);
+               $GLOBALS['typo3CacheManager'] = $this->getMock('t3lib_cache_Manager', array('getCache'));
+               $GLOBALS['typo3CacheManager']->expects($this->any())->method('getCache')->will($this->returnValue($mockCache));
+               $mockCache->expects($this->once())->method('flushByTag')->with($this->equalTo('core'));
+               t3lib_extMgm::removeCacheFiles();
+       }
 
        /////////////////////////////////////////
        // Tests concerning getExtensionVersion
index 217b354..19198ef 100644 (file)
@@ -61,6 +61,8 @@ class Typo3_Bootstrap {
        }
 
        /**
+        * Return 'this' as singleton
+        *
         * @return Typo3_Bootstrap
         */
        public static function getInstance() {
@@ -606,44 +608,29 @@ class Typo3_Bootstrap {
        }
 
        /**
+        * Set up $GLOBALS['TYPO3_LOADED_EXT'] array with basic information
+        * about extensions.
+        *
+        * @param boolean $allowCaching
+        * @return Typo3_Bootstrap
+        */
+       public function populateTypo3LoadedExtGlobal($allowCaching = TRUE) {
+               $GLOBALS['TYPO3_LOADED_EXT'] = t3lib_extMgm::loadTypo3LoadedExtensionInformation($allowCaching);
+
+               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.
         *
+        * @param boolean $allowCaching
         * @return Typo3_Bootstrap
         */
-       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']);
-                               }
-                       }
-               }
+       public function loadAdditionalConfigurationFromExtensions($allowCaching = TRUE) {
+               t3lib_extMgm::loadExtLocalconf($allowCaching);
 
                return $this;
        }
@@ -667,6 +654,25 @@ class Typo3_Bootstrap {
        }
 
        /**
+        * Write deprecation log if deprecated extCache setting was set in the instance.
+        *
+        * @return Typo3_Bootstrap
+        * @deprecated since 6.0, the check will be removed two version later.
+        */
+       public function deprecationLogForOldExtCacheSetting() {
+               if (
+                       isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['extCache'])
+                       && $GLOBALS['TYPO3_CONF_VARS']['SYS']['extCache'] !== -1
+               ) {
+                       t3lib_div::deprecationLog(
+                               'Setting $GLOBALS[\'TYPO3_CONF_VARS\'][\'SYS\'][\'extCache\'] is unused and can be removed from localconf.php'
+                       );
+               }
+
+               return $this;
+       }
+
+       /**
         * Initialize exception handling
         *
         * @return Typo3_Bootstrap
@@ -756,7 +762,7 @@ class Typo3_Bootstrap {
        /**
         * Initialize t3lib_db in $GLOBALS and connect if requested
         *
-        * @param bool $connect Whether or not the db should be connected already
+        * @param boolean $connect Whether or not the db should be connected already
         * @return Typo3_Bootstrap
         */
        public function initializeTypo3DbGlobal($connect = TRUE) {
@@ -882,7 +888,7 @@ class Typo3_Bootstrap {
         * This will mainly set up $TCA and several other global arrays
         * through API's like extMgm.
         * Executes ext_tables.php files of loaded extensions or the
-        * according typo3conf/temp_CACHED_*_ext_tables.php if exists.
+        * according cache file if exists.
         *
         * Note: For backwards compatibility some global variables are
         * explicitly set as global to be used without $GLOBALS[] in
@@ -897,9 +903,12 @@ class Typo3_Bootstrap {
         *
         * @TODO: It should be defined, which global arrays are ok to be manipulated
         *
+        * @param boolean $allowCaching True, if reading compiled ext_tables file from cache is allowed
         * @return Typo3_Bootstrap
         */
-       public function loadExtensionTables() {
+       public function loadExtensionTables($allowCaching = TRUE) {
+                       // It is discouraged to use those global variables directly, but we
+                       // can not prohibit this without breaking backwards compatibility
                global $T3_SERVICES, $T3_VAR, $TYPO3_CONF_VARS;
                global $TBE_MODULES, $TBE_MODULES_EXT, $TCA;
                global $PAGES_TYPES, $TBE_STYLES, $FILEICONS;
@@ -907,23 +916,7 @@ class Typo3_Bootstrap {
                        // Include standard tables.php file
                require(PATH_t3lib . 'stddb/tables.php');
 
-               if (
-                       $GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE']
-                       && file_exists(PATH_typo3conf . $GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'] . '_ext_tables.php')
-               ) {
-                               // Load temp_CACHED_x_ext_tables.php file if exists
-                       require(PATH_typo3conf . $GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'] . '_ext_tables.php');
-               } else {
-                               // Load each ext_tables.php file of loaded extensions
-                       foreach ($GLOBALS['TYPO3_LOADED_EXT'] as $_EXTKEY => $extensionInformation) {
-                               if (is_array($extensionInformation) && $extensionInformation['ext_tables.php']) {
-                                               // $_EXTKEY and $_EXTCONF are available in ext_tables.php
-                                               // and are explicitly set in temp_CACHED file as well
-                                       $_EXTCONF = $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY];
-                                       require($extensionInformation['ext_tables.php']);
-                               }
-                       }
-               }
+               t3lib_extMgm::loadExtTables($allowCaching);
 
                        // Load additional ext tables script if registered
                if (TYPO3_extTableDef_script) {
@@ -960,7 +953,7 @@ class Typo3_Bootstrap {
        /**
         * Initialize sprite manager global
         *
-        * @param bool $allowRegeneration
+        * @param boolean $allowRegeneration
         * @return Typo3_Bootstrap
         */
        public function initializeSpriteManager($allowRegeneration = TRUE) {
@@ -1086,4 +1079,4 @@ class Typo3_Bootstrap {
        }
 
 }
-?>
+?>
\ No newline at end of file
index 60e7c1a..25c001f 100644 (file)
@@ -92,7 +92,7 @@ class ClearCacheMenu implements backend_toolbarItem {
                }
 
                        // Clearing of cache-files in typo3conf/ + menu
-               if ($GLOBALS['BE_USER']->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['EXT']['extCache']) {
+               if ($GLOBALS['BE_USER']->isAdmin()) {
                        $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:rm.clearCacheMenu_allTypo3Conf', TRUE);
                        $this->cacheActions[] = array(
                                'id'    => 'temp_CACHED',
index 864c35b..aecc85e 100755 (executable)
@@ -37,7 +37,7 @@
  * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
  */
 
-define('TYPO3_MODE','BE');
+define('TYPO3_MODE', 'BE');
 define('TYPO3_cliMode', TRUE);
 
        // We use require instead of require_once here so we get a fatal error if classes/Bootstrap.php is accidentally included twice
@@ -68,8 +68,10 @@ Typo3_Bootstrap::getInstance()
        ->configureExceptionHandling()
        ->setMemoryLimit()
        ->defineTypo3RequestTypes()
-       ->loadAdditionalConfigurationFromExtensions()
+       ->populateTypo3LoadedExtGlobal(TRUE)
+       ->loadAdditionalConfigurationFromExtensions(TRUE)
        ->deprecationLogForOldXclassRegistration()
+       ->deprecationLogForOldExtCacheSetting()
        ->initializeExceptionHandling()
        ->requireAdditionalExtensionFiles()
        ->setFinalCachingFrameworkCacheConfiguration()
@@ -78,7 +80,7 @@ Typo3_Bootstrap::getInstance()
        ->initializeTypo3DbGlobal(TRUE);
 Typo3_Bootstrap_Cli::initializeCliKeyOrDie();
 Typo3_Bootstrap::getInstance()
-       ->loadExtensionTables()
+       ->loadExtensionTables(TRUE)
                // TODO: Check if we really need the sprite manager on the command line
        ->initializeSpriteManager(TRUE)
        ->initializeBackendUser()
index 6c17d78..d68264d 100644 (file)
@@ -83,8 +83,10 @@ Typo3_Bootstrap::getInstance()
        ->configureExceptionHandling()
        ->setMemoryLimit()
        ->defineTypo3RequestTypes()
-       ->loadAdditionalConfigurationFromExtensions()
+       ->populateTypo3LoadedExtGlobal(TRUE)
+       ->loadAdditionalConfigurationFromExtensions(TRUE)
        ->deprecationLogForOldXclassRegistration()
+       ->deprecationLogForOldExtCacheSetting()
        ->initializeExceptionHandling()
        ->requireAdditionalExtensionFiles()
        ->setFinalCachingFrameworkCacheConfiguration()
@@ -97,7 +99,7 @@ Typo3_Bootstrap::getInstance()
        ->redirectToInstallToolIfDatabaseCredentialsAreMissing()
        ->checkValidBrowserOrDie()
        ->establishDatabaseConnection()
-       ->loadExtensionTables()
+       ->loadExtensionTables(TRUE)
        ->initializeSpriteManager(TRUE)
        ->initializeBackendUser()
        ->initializeBackendUserMounts()
@@ -106,4 +108,4 @@ Typo3_Bootstrap::getInstance()
        ->initializeBackendTemplate()
        ->endOutputBufferingAndCleanPreviousOutput()
        ->initializeOutputCompression();
-?>
+?>
\ No newline at end of file
index 901d9b4..f85d76c 100755 (executable)
@@ -66,8 +66,10 @@ Typo3_Bootstrap::getInstance()
        ->configureExceptionHandling()
        ->setMemoryLimit()
        ->defineTypo3RequestTypes()
-       ->loadAdditionalConfigurationFromExtensions()
+       ->populateTypo3LoadedExtGlobal(FALSE)
+       ->loadAdditionalConfigurationFromExtensions(FALSE)
        ->deprecationLogForOldXclassRegistration()
+       ->deprecationLogForOldExtCacheSetting()
        ->initializeExceptionHandling()
        ->requireAdditionalExtensionFiles()
        ->setFinalCachingFrameworkCacheConfiguration()
index 35a34b5..28d30e5 100644 (file)
@@ -573,19 +573,17 @@ class tx_aboutmodules_Functions {
                $functions = array();
 
                // Clearing of cache-files in typo3conf/ + menu
-               if ($GLOBALS['TYPO3_CONF_VARS']['EXT']['extCache']) {
-                       $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_allTypo3Conf');
-                       $functions[] = array(
-                               'id' => 'temp_CACHED',
-                               'title' => $title,
-                               'href' => $backPath .
-                                               'tce_db.php?vC=' . $GLOBALS['BE_USER']->veriCode() .
-                                               '&redirect=' . rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT')) .
-                                               '&cacheCmd=temp_CACHED' .
-                                               t3lib_BEfunc::getUrlToken('tceAction'),
-                               'icon' => '<img' . t3lib_iconWorks::skinImg($backPath, 'gfx/clear_cache_files_in_typo3c.gif', 'width="21" height="18"') . ' title="' . htmlspecialchars($title) . '" alt="" />'
-                       );
-               }
+               $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_allTypo3Conf');
+               $functions[] = array(
+                       'id' => 'temp_CACHED',
+                       'title' => $title,
+                       'href' => $backPath .
+                                       'tce_db.php?vC=' . $GLOBALS['BE_USER']->veriCode() .
+                                       '&redirect=' . rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT')) .
+                                       '&cacheCmd=temp_CACHED' .
+                                       t3lib_BEfunc::getUrlToken('tceAction'),
+                       'icon' => '<img' . t3lib_iconWorks::skinImg($backPath, 'gfx/clear_cache_files_in_typo3c.gif', 'width="21" height="18"') . ' title="' . htmlspecialchars($title) . '" alt="" />'
+               );
 
                // Clear all page cache
                $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_all');
index 948f416..d5d8b36 100644 (file)
@@ -2123,14 +2123,10 @@ class tslib_fe {
                                // Create hash string for storage / retrieval of cached content:
                        $tempHash = md5('tables.php:'.
                                filemtime(TYPO3_extTableDef_script ? PATH_typo3conf.TYPO3_extTableDef_script : PATH_t3lib.'stddb/tables.php').
-                               (TYPO3_extTableDef_script?filemtime(PATH_typo3conf.TYPO3_extTableDef_script):'').
-                               ($GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'] ? filemtime(PATH_typo3conf.$GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'].'_ext_tables.php') : '')
+                               (TYPO3_extTableDef_script?filemtime(PATH_typo3conf.TYPO3_extTableDef_script):'')
                        );
 
-                       if ($this->TYPO3_CONF_VARS['EXT']['extCache'] != 0) {
-                                       // Try to fetch if cache is enabled
-                               list($GLOBALS['TCA'], $this->TCAcachedExtras) = unserialize($this->sys_page->getHash($tempHash));
-                       }
+                       list($GLOBALS['TCA'], $this->TCAcachedExtras) = unserialize($this->sys_page->getHash($tempHash));
 
                                // If no result, create it:
                        if (!is_array($GLOBALS['TCA'])) {
@@ -2156,10 +2152,7 @@ class tslib_fe {
                                }
 
                                $GLOBALS['TCA'] = $newTc;
-                                       // Store it in cache if cache is enabled
-                               if ($this->TYPO3_CONF_VARS['EXT']['extCache'] != 0) {
-                                       $this->sys_page->storeHash($tempHash, serialize(array($newTc, $this->TCAcachedExtras)), 'SHORT_TC');
-                               }
+                               $this->sys_page->storeHash($tempHash, serialize(array($newTc, $this->TCAcachedExtras)), 'SHORT_TC');
                        }
                }
                $GLOBALS['TT']->pull();
@@ -2179,7 +2172,7 @@ class tslib_fe {
        public function includeTCA($TCAloaded = 1) {
                if (!$this->TCAloaded) {
                        $GLOBALS['TCA'] = array();
-                       Typo3_Bootstrap::getInstance()->loadExtensionTables();
+                       Typo3_Bootstrap::getInstance()->loadExtensionTables(TRUE);
                        $this->TCAloaded = $TCAloaded;
                }
        }
@@ -4762,4 +4755,4 @@ if (version == "n3") {
                return $result;
        }
 }
-?>
\ No newline at end of file
+?>
index 30c9cd3..4454a82 100644 (file)
@@ -66,8 +66,10 @@ Typo3_Bootstrap::getInstance()
        ->configureExceptionHandling()
        ->setMemoryLimit()
        ->defineTypo3RequestTypes()
-       ->loadAdditionalConfigurationFromExtensions()
+       ->populateTypo3LoadedExtGlobal(TRUE)
+       ->loadAdditionalConfigurationFromExtensions(TRUE)
        ->deprecationLogForOldXclassRegistration()
+       ->deprecationLogForOldExtCacheSetting()
        ->initializeExceptionHandling()
        ->requireAdditionalExtensionFiles()
        ->setFinalCachingFrameworkCacheConfiguration()
index f5eb9c4..118eba9 100644 (file)
@@ -938,7 +938,7 @@ EXTENSION KEYS:
        function removeRequiredExtFromListArr($listArr) {
                $requiredExtensions = t3lib_div::trimExplode(',', t3lib_extMgm::getRequiredExtensionList(), 1);
                foreach ($listArr as $k => $ext) {
-                       if (in_array($ext, $requiredExtensions) || !strcmp($ext, '_CACHEFILE')) {
+                       if (in_array($ext, $requiredExtensions)) {
                                unset($listArr[$k]);
                        }
                }
index 5df555b..95446e9 100644 (file)
@@ -259,11 +259,8 @@ class tx_em_Install {
                                                                                        // Remove cache files:
                                                                                        $updateContent = '';
                                                                                        if (t3lib_extMgm::isLoaded($extKey)) {
-                                                                                               if (t3lib_extMgm::removeCacheFiles()) {
-                                                                                                       $messageContent .= $GLOBALS['LANG']->getLL('ext_import_cache_files_removed') . '<br />';
-                                                                                               }
-                                                                                                       // Flush autoloader cache
-                                                                                               $GLOBALS['typo3CacheManager']->getCache('cache_phpcode')->flushByTag('t3lib_autoloader');
+                                                                                               t3lib_extMgm::removeCacheFiles();
+                                                                                               $messageContent .= $GLOBALS['LANG']->getLL('ext_import_cache_files_removed') . '<br />';
 
                                                                                                list($new_list) = $this->parentObject->extensionList->getInstalledExtensions();
                                                                                                $updateContent = $this->updatesForm($extKey, $new_list[$extKey], 1, t3lib_div::linkThisScript(array(
@@ -1464,7 +1461,7 @@ class tx_em_Install {
 
        /**
         * Writes the TSstyleconf values to "localconf.php"
-        * Removes the temp_CACHED* files before return.
+        * Removes the cached core files before return.
         *
         * @param       string          Extension key
         * @param       array           Configuration array to write back
@@ -1568,7 +1565,7 @@ class tx_em_Install {
 
        /**
         * Writes the extension list to "localconf.php" file
-        * Removes the temp_CACHED* files before return.
+        * Removes the cached core files before return.
         *
         * @param       string          List of extensions
         * @return      void
@@ -1587,7 +1584,6 @@ class tx_em_Install {
 
                $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'] = $newExtList;
                t3lib_extMgm::removeCacheFiles();
-               $GLOBALS['typo3CacheManager']->getCache('cache_phpcode')->flushByTag('t3lib_autoloader');
        }
 
        /**
index 10d2aaa..6da91a3 100644 (file)
@@ -135,20 +135,9 @@ final class tx_em_Tools {
         * @return void
         */
        public static function refreshGlobalExtList() {
-               $GLOBALS['TYPO3_LOADED_EXT'] = t3lib_extMgm::typo3_loadExtensions();
-               if ($GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE']) {
-                       require(PATH_typo3conf . $GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'] . '_ext_localconf.php');
-               } else {
-                       $temp_TYPO3_LOADED_EXT = $GLOBALS['TYPO3_LOADED_EXT'];
-                       foreach ($temp_TYPO3_LOADED_EXT as $_EXTKEY => $temp_lEDat) {
-                               if (is_array($temp_lEDat) && $temp_lEDat['ext_localconf.php']) {
-                                               // Make sure $TYPO3_CONF_VARS is also available within the included files
-                                       global $TYPO3_CONF_VARS;
-                                       $_EXTCONF = $TYPO3_CONF_VARS['EXT']['extConf'][$_EXTKEY];
-                                       require($temp_lEDat['ext_localconf.php']);
-                               }
-                       }
-               }
+               Typo3_Bootstrap::getInstance()
+                       ->populateTypo3LoadedExtGlobal(FALSE)
+                       ->loadAdditionalConfigurationFromExtensions(FALSE);
        }
 
        /**
index 95f1d92..fb256f5 100644 (file)
@@ -199,7 +199,6 @@ class tx_em_Translations {
 
                        if (t3lib_div::_GET('l10n') == 'check') {
                                $loadedExtensions = array_keys($TYPO3_LOADED_EXT);
-                               $loadedExtensions = array_diff($loadedExtensions, array('_CACHEFILE'));
 
                                // Override content output - we now do that ourselves:
                                $this->parentObject->content .= $this->parentObject->doc->section($GLOBALS['LANG']->getLL('translation_status'), $content, 0, 1);
index 0ccf631..b900e9a 100755 (executable)
@@ -1600,12 +1600,10 @@ class SC_mod_tools_log_index extends t3lib_SCbase {
                $opt = array();
                $opt[] = '<option value=""></option>';
                foreach ($extTrav as $v) {
-                       if ($v!=='_CACHEFILE') {
-                               if (is_array($value)) {
-                                       $sel = in_array($v, $value)?' selected="selected"':'';
-                               }
-                               $opt[] = '<option value="'.htmlspecialchars($v).'"'.$sel.'>'.htmlspecialchars($v).'</option>';
+                       if (is_array($value)) {
+                               $sel = in_array($v, $value)?' selected="selected"':'';
                        }
+                       $opt[] = '<option value="'.htmlspecialchars($v).'"'.$sel.'>'.htmlspecialchars($v).'</option>';
                }
                return '<select name="'.$prefix.'[]" multiple="multiple" size="'.t3lib_utility_Math::forceIntegerInRange(count($opt), 5, 10).'">'.implode('', $opt).'</select>';
        }
index 2d9dd26..238c9cd 100644 (file)
@@ -6390,8 +6390,7 @@ REMOTE_ADDR was '".t3lib_div::getIndpEnv('REMOTE_ADDR')."' (".t3lib_div::getIndp
         * @return void
         */
        function updateWizard() {
-                       // clear cache files
-               t3lib_extMgm::removeCacheFiles(t3lib_extMgm::getCacheFilePrefix());
+               t3lib_extMgm::removeCacheFiles();
 
                        // Forces creation / update of caching framework tables that are needed by some update wizards
                $cacheTablesConfiguration = implode(LF, $this->sqlHandler->getStatementArray(t3lib_cache::getDatabaseTableDefinitions(), 1, '^CREATE TABLE '));
@@ -7495,7 +7494,7 @@ $out="
         * @return void
         */
        function includeTCA() {
-               Typo3_Bootstrap::getInstance()->loadExtensionTables();
+               Typo3_Bootstrap::getInstance()->loadExtensionTables(FALSE);
 
                foreach ($GLOBALS['TCA'] as $table => $conf) {
                        t3lib_div::loadTCA($table);
index 2824c0f..141db8d 100644 (file)
@@ -64,7 +64,7 @@ class tx_coreupdates_migrateworkspaces extends tx_coreupdates_installsysexts {
                                        install "fluid" and "extbase" too, as they are used by the "workspaces" extension).';
                        } else {
 
-                               Typo3_Bootstrap::getInstance()->loadExtensionTables();
+                               Typo3_Bootstrap::getInstance()->loadExtensionTables(FALSE);
 
                                if (!t3lib_extMgm::isLoaded('version') || !t3lib_extMgm::isLoaded('workspaces')) {
                                        $result = TRUE;
@@ -153,7 +153,7 @@ class tx_coreupdates_migrateworkspaces extends tx_coreupdates_installsysexts {
                        return TRUE;
                }
 
-               Typo3_Bootstrap::getInstance()->loadExtensionTables();
+               Typo3_Bootstrap::getInstance()->loadExtensionTables(FALSE);
 
                        // install version and workspace extension (especially when updating from very old TYPO3 versions
                $this->installExtensions(array('extbase', 'fluid', 'version', 'workspaces'));
index d81f11f..67abae0 100644 (file)
@@ -98,9 +98,6 @@ class tx_coreupdates_t3skin extends Tx_Install_Updates_Base {
        protected function addExtToList(array $extKeys) {
                        // Get list of installed extensions and add this one.
                $tmpLoadedExt = $GLOBALS['TYPO3_LOADED_EXT'];
-               if (isset($tmpLoadedExt['_CACHEFILE'])) {
-                       unset($tmpLoadedExt['_CACHEFILE']);
-               }
 
                $listArr = array_keys($tmpLoadedExt);
                $listArr = array_merge($listArr, $extKeys);
@@ -112,7 +109,7 @@ class tx_coreupdates_t3skin extends Tx_Install_Updates_Base {
 
        /**
         * Writes the extension list to "localconf.php" file
-        * Removes the temp_CACHED* files before return.
+        * Removes the cached core files before return.
         *
         * @param       string          List of extensions
         * @return      string          Result of writeToLocalconf_control()
index c31cf01..dd66ff6 100644 (file)
@@ -64,7 +64,7 @@ For another backend user it might be different. This screen shot shows how anoth
 A very central cache is the database cache table, "cache_hash", which needs to be flushed after certain major changes in the system. You "clear all cache" by clicking the link with the blue icon. After this operation any website content should be re-generated from the sources rather than be delivered from caches. This operation clears &lt;i&gt;all&lt;/i&gt; database tables registered as flushable cache tables.
 
 &lt;b&gt;Cached PHP configuration files from Extensions&lt;/b&gt;
-TYPO3 also caches small configuration scripts from extensions, "ext_localconf.php" and "ext_tables.php". These files are simply read from all installed extensions and concatenated into temporary PHP scripts found in the typo3conf/ folder, named "temp_CACHED_*.php". Sometimes you need to remove these files so TYPO3 re-writes them from the originals. This is done by the "Clear temp_CACHED" link.
+TYPO3 also caches small configuration scripts from extensions, "ext_localconf.php" and "ext_tables.php". These files are simply read from all installed extensions and concatenated into temporary PHP scripts found in the typo3temp/Cache/Code/cache_phpcode/ folder. Sometimes you need to remove these files so TYPO3 re-writes them from the originals. This is done by the "Clear temp_CACHED" link.
 
 &lt;b&gt;Notice:&lt;/b&gt; You should not clear these caches without a second thought. Clearing caches may affect performance on your server negatively for a while. Obviously the cached content has to be regenerated which takes time and under heavy load it might make your server un-available for a while.</source>
                        </trans-unit>
@@ -956,4 +956,4 @@ When working in the default Draft workspace or any customly created workspaces c
                        </trans-unit>
                </body>
        </file>
-</xliff>
+</xliff>
\ No newline at end of file
index b681c88..2048c3b 100644 (file)
@@ -90,7 +90,7 @@ class tx_saltedpasswords_autoloader {
                        $extList[] = 'saltedpasswords';
                }
                $this->updateExtensionList(implode(',', $extList));
-               $GLOBALS['typo3CacheManager']->getCache('cache_phpcode')->flushByTag('t3lib_autoloader');
+               t3lib_extMgm::removeCacheFiles();
        }
 
        /**
@@ -125,11 +125,6 @@ class tx_saltedpasswords_autoloader {
                }
 
                $GLOBALS['TYPO3_CONF_VARS']['EXT']['extList'] = $newExtList;
-
-                       // Make sure to get cache file for backend, not frontend
-               $cacheFilePrefix = t3lib_extMgm::getCacheFilePrefix();
-               $GLOBALS['TYPO3_LOADED_EXT']['_CACHEFILE'] = str_replace('temp_CACHED_FE', 'temp_CACHED', $cacheFilePrefix);
-               t3lib_extMgm::removeCacheFiles();
        }
 
 }