From f009f644b59f3cb8dcf8f944899acc69c0229f5a Mon Sep 17 00:00:00 2001 From: Christian Kuhn Date: Sun, 19 Jun 2011 13:40:35 +0200 Subject: [PATCH] [BUGFIX] Adapt cache configuration to 4.6 Change-Id: Ifcc5f66cd61c32bf2bf219da21eea67939d3b77c Resolves: #27546 Depends: #27506 Depends: #27536 --- Classes/Core/Bootstrap.php | 13 +----- Classes/Object/Container/ClassInfoCache.php | 12 +---- ext_localconf.php | 29 ++++-------- ext_tables.php | 23 --------- ext_tables.sql | 52 --------------------- 5 files changed, 12 insertions(+), 117 deletions(-) diff --git a/Classes/Core/Bootstrap.php b/Classes/Core/Bootstrap.php index f2feb051..64f46ff3 100644 --- a/Classes/Core/Bootstrap.php +++ b/Classes/Core/Bootstrap.php @@ -172,18 +172,7 @@ public function configureObjectManager() { * @see initialize() */ protected function initializeCache() { - t3lib_cache::initializeCachingFramework(); $this->cacheManager = $GLOBALS['typo3CacheManager']; - try { - $this->cacheManager->getCache('cache_extbase_reflection'); - } catch (t3lib_cache_exception_NoSuchCache $exception) { - $GLOBALS['typo3CacheFactory']->create( - 'cache_extbase_reflection', - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['frontend'], - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['backend'], - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['options'] - ); - } } /** @@ -194,7 +183,7 @@ protected function initializeCache() { */ protected function initializeReflection() { $this->reflectionService = $this->objectManager->get('Tx_Extbase_Reflection_Service'); - $this->reflectionService->setDataCache($this->cacheManager->getCache('cache_extbase_reflection')); + $this->reflectionService->setDataCache($this->cacheManager->getCache('extbase_reflection')); if (!$this->reflectionService->isInitialized()) { $this->reflectionService->initialize(); } diff --git a/Classes/Object/Container/ClassInfoCache.php b/Classes/Object/Container/ClassInfoCache.php index e621cf64..a6c46c3a 100644 --- a/Classes/Object/Container/ClassInfoCache.php +++ b/Classes/Object/Container/ClassInfoCache.php @@ -86,16 +86,6 @@ public function set($id,$value) { * Initialize the TYPO3 second level cache */ private function initializeLevel2Cache() { - t3lib_cache::initializeCachingFramework(); - try { - $this->level2Cache = $GLOBALS['typo3CacheManager']->getCache('cache_extbase_object'); - } catch (t3lib_cache_exception_NoSuchCache $exception) { - $this->level2Cache = $GLOBALS['typo3CacheFactory']->create( - 'cache_extbase_object', - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_object']['frontend'], - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_object']['backend'], - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_object']['options'] - ); - } + $this->level2Cache = $GLOBALS['typo3CacheManager']->getCache('extbase_object'); } } \ No newline at end of file diff --git a/ext_localconf.php b/ext_localconf.php index 71ae4b51..8c43580c 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -4,25 +4,16 @@ require_once(t3lib_extMgm::extPath('extbase') . 'Classes/Dispatcher.php'); require_once(t3lib_extMgm::extPath('extbase') . 'Classes/Utility/Extension.php'); -// use own cache tables -// Reflection cache: -$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection'] = array( - 'frontend' => 't3lib_cache_frontend_VariableFrontend', - 'backend' => 't3lib_cache_backend_DbBackend', - 'options' => array( - 'cacheTable' => 'tx_extbase_cache_reflection', - 'tagsTable' => 'tx_extbase_cache_reflection_tags', - ), -); -// Object container cache: -$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_object'] = array( - 'frontend' => 't3lib_cache_frontend_VariableFrontend', - 'backend' => 't3lib_cache_backend_DbBackend', - 'options' => array( - 'cacheTable' => 'tx_extbase_cache_object', - 'tagsTable' => 'tx_extbase_cache_object_tags', - ), -); + // Register caches if not already done in localconf.php or a previously loaded extension. + // We do not set frontend and backend: The cache manager uses t3lib_cache_frontend_VariableFrontend + // and t3lib_cache_backend_DbBackend by default if not set otherwise. + // This default is perfectly fine for our reflection and object cache. +if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['extbase_reflection'])) { + $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['extbase_reflection'] = array(); +} +if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['extbase_object'])) { + $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['extbase_object'] = array(); +} // We need to set the default implementation for Storage Backend & Query Settings // the code below is NO PUBLIC API! It's just to make sure that diff --git a/ext_tables.php b/ext_tables.php index c05486b2..07e877dc 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -2,30 +2,7 @@ if (!defined ('TYPO3_MODE')) die ('Access denied.'); if (TYPO3_MODE == 'BE') { - - // register the cache in BE so it will be cleared with "clear all caches" - try { - t3lib_cache::initializeCachingFramework(); - // Reflection cache - $GLOBALS['typo3CacheFactory']->create( - 'tx_extbase_cache_reflection', - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['frontend'], - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['backend'], - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['options'] - ); - // Object container cache - $GLOBALS['typo3CacheFactory']->create( - 'tx_extbase_cache_object', - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_object']['frontend'], - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_object']['backend'], - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_object']['options'] - ); - } catch(t3lib_cache_exception_NoSuchCache $exception) { - - } - $TBE_MODULES['_dispatcher'][] = 'Tx_Extbase_Core_Bootstrap'; - } $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_reports']['status']['providers']['extbase'][] = 'tx_extbase_utility_extbaserequirementscheck'; diff --git a/ext_tables.sql b/ext_tables.sql index 8cedb0b7..3fd96d35 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -1,55 +1,3 @@ -# -# Table structure for table 'tx_extbase_cache_reflection' -# -CREATE TABLE tx_extbase_cache_reflection ( - id int(11) unsigned NOT NULL auto_increment, - identifier varchar(250) DEFAULT '' NOT NULL, - crdate int(11) unsigned DEFAULT '0' NOT NULL, - content mediumtext, - tags mediumtext, - lifetime int(11) unsigned DEFAULT '0' NOT NULL, - PRIMARY KEY (id), - KEY cache_id (identifier) -) ENGINE=InnoDB; - -# -# Table structure for table 'tx_extbase_cache_reflection_tags' -# -CREATE TABLE tx_extbase_cache_reflection_tags ( - id int(11) unsigned NOT NULL auto_increment, - identifier varchar(128) DEFAULT '' NOT NULL, - tag varchar(128) DEFAULT '' NOT NULL, - PRIMARY KEY (id), - KEY cache_id (identifier), - KEY cache_tag (tag) -) ENGINE=InnoDB; - -# -# Table structure for table 'tx_extbase_cache_object' -# -CREATE TABLE tx_extbase_cache_object ( - id int(11) unsigned NOT NULL auto_increment, - identifier varchar(250) DEFAULT '' NOT NULL, - crdate int(11) unsigned DEFAULT '0' NOT NULL, - content mediumtext, - tags mediumtext, - lifetime int(11) unsigned DEFAULT '0' NOT NULL, - PRIMARY KEY (id), - KEY cache_id (identifier) -) ENGINE=InnoDB; - -# -# Table structure for table 'tx_extbase_cache_object_tags' -# -CREATE TABLE tx_extbase_cache_object_tags ( - id int(11) unsigned NOT NULL auto_increment, - identifier varchar(128) DEFAULT '' NOT NULL, - tag varchar(128) DEFAULT '' NOT NULL, - PRIMARY KEY (id), - KEY cache_id (identifier), - KEY cache_tag (tag) -) ENGINE=InnoDB; - # # Add field 'tx_extbase_type' to table 'fe_users' #