[FEATURE] Enable caching framework by default
authorChristian Kuhn <lolli@schwarzbu.ch>
Thu, 23 Jun 2011 22:00:18 +0000 (00:00 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 24 Jun 2011 11:08:39 +0000 (13:08 +0200)
The caching framework matured and is ready for default use. The patch
defines TYPO3_UseCachingFramework to true, removes old core cache tables
and cleans up current cache usage in the core.

Change-Id: Ib49d8e43f535e9984e8a22ee3a8454392980035b
Resolves: #25106
Reviewed-on: http://review.typo3.org/2902
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
15 files changed:
t3lib/class.t3lib_befunc.php
t3lib/class.t3lib_cache.php
t3lib/class.t3lib_page.php
t3lib/class.t3lib_tcemain.php
t3lib/class.t3lib_tsfebeuserauth.php
t3lib/class.t3lib_tstemplate.php
t3lib/config_default.php
t3lib/stddb/tables.sql
typo3/init.php
typo3/sysext/cms/ext_tables.sql
typo3/sysext/cms/tslib/class.tslib_fe.php
typo3/sysext/cms/tslib/class.tslib_fetce.php
typo3/sysext/indexed_search/modfunc1/class.tx_indexedsearch_modfunc1.php
typo3/sysext/lang/classes/cache/class.tx_lang_cache_file.php [deleted file]
typo3/sysext/lang/classes/class.tx_lang_factory.php

index c8ab8bb..1b37bcd 100644 (file)
@@ -1246,23 +1246,12 @@ final class t3lib_BEfunc {
         * @return      void
         */
        public static function storeHash($hash, $data, $ident) {
-               if (TYPO3_UseCachingFramework) {
-                       $GLOBALS['typo3CacheManager']->getCache('cache_hash')->set(
-                               $hash,
-                               $data,
-                               array('ident_' . $ident),
-                               0 // unlimited lifetime
-                       );
-               } else {
-                       $insertFields = array(
-                               'hash' => $hash,
-                               'content' => $data,
-                               'ident' => $ident,
-                               'tstamp' => $GLOBALS['EXEC_TIME']
-                       );
-                       $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_hash', 'hash=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($hash, 'cache_hash'));
-                       $GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_hash', $insertFields);
-               }
+               $GLOBALS['typo3CacheManager']->getCache('cache_hash')->set(
+                       $hash,
+                       $data,
+                       array('ident_' . $ident),
+                       0 // unlimited lifetime
+               );
        }
 
        /**
@@ -1276,23 +1265,9 @@ final class t3lib_BEfunc {
         */
        public static function getHash($hash, $expTime = 0) {
                $hashContent = NULL;
-               if (TYPO3_UseCachingFramework) {
-                       $contentHashCache = $GLOBALS['typo3CacheManager']->getCache('cache_hash');
-                       $cacheEntry = $contentHashCache->get($hash);
-
-                       if ($cacheEntry) {
-                               $hashContent = $cacheEntry;
-                       }
-               } else {
-                       $expTime = intval($expTime);
-                       if ($expTime) {
-                               $whereAdd = ' AND tstamp > ' . (time() - $expTime);
-                       }
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('content', 'cache_hash', 'hash=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($hash, 'cache_hash') . $whereAdd);
-                       $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
-                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
-
-                       $hashContent = (is_array($row) ? $row['content'] : NULL);
+               $cacheEntry = $GLOBALS['typo3CacheManager']->getCache('cache_hash')->get($hash);
+               if ($cacheEntry) {
+                       $hashContent = $cacheEntry;
                }
                return $hashContent;
        }
@@ -4596,4 +4571,4 @@ final class t3lib_BEfunc {
        }
 }
 
-?>
+?>
\ No newline at end of file
index c54820d..1cf359c 100644 (file)
@@ -115,18 +115,11 @@ class t3lib_cache {
         * This method can be called by extensions in their ext_localconf.php. Calling it later would not work,
         * since rendering is already started using the defined caches.
         *
+        * @deprecated since 4.6, will be removed in 4.8: The caching framework is enabled by default
         * @return      void
         */
        public function enableCachingFramework() {
-               if (!defined('TYPO3_UseCachingFramework')) {
-                       $GLOBALS['TYPO3_CONF_VARS']['SYS']['useCachingFramework'] = 1;
-               } elseif (!TYPO3_UseCachingFramework) {
-                       throw new RuntimeException(
-                               'The caching framework was already defined to be disabled and cannot be changed. ' .
-                                               'Please put your call to t3lib_cache::enableCachingFramework() into ext_localconf.php.',
-                               1253273131
-                       );
-               }
+               t3lib_div::logDeprecatedFunction();
        }
 }
 
index 528d112..75c5fed 100644 (file)
@@ -976,27 +976,15 @@ class t3lib_pageSelect {
        public static function getHash($hash, $expTime = 0) {
                $hashContent = NULL;
 
-               if (TYPO3_UseCachingFramework) {
-                       if (is_object($GLOBALS['typo3CacheManager'])) {
-                               $contentHashCache = $GLOBALS['typo3CacheManager']->getCache('cache_hash');
-                               $cacheEntry = $contentHashCache->get($hash);
+               if (is_object($GLOBALS['typo3CacheManager'])) {
+                       $contentHashCache = $GLOBALS['typo3CacheManager']->getCache('cache_hash');
+                       $cacheEntry = $contentHashCache->get($hash);
 
-                               if ($cacheEntry) {
-                                       $hashContent = $cacheEntry;
-                               }
-                       }
-               } else {
-                       $expTime = intval($expTime);
-                       if ($expTime) {
-                               $whereAdd = ' AND tstamp > ' . ($GLOBALS['ACCESS_TIME'] - $expTime);
-                       }
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('content', 'cache_hash', 'hash=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($hash, 'cache_hash') . $whereAdd);
-                       $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
-                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
-                       if ($row) {
-                               $hashContent = $row['content'];
+                       if ($cacheEntry) {
+                               $hashContent = $cacheEntry;
                        }
                }
+
                return $hashContent;
        }
 
@@ -1013,24 +1001,13 @@ class t3lib_pageSelect {
         * @see tslib_TStemplate::start(), getHash()
         */
        public static function storeHash($hash, $data, $ident, $lifetime = 0) {
-               if (TYPO3_UseCachingFramework) {
-                       if (is_object($GLOBALS['typo3CacheManager'])) {
-                               $GLOBALS['typo3CacheManager']->getCache('cache_hash')->set(
-                                       $hash,
-                                       $data,
-                                       array('ident_' . $ident),
-                                       intval($lifetime)
-                               );
-                       }
-               } else {
-                       $insertFields = array(
-                               'hash' => $hash,
-                               'content' => $data,
-                               'ident' => $ident,
-                               'tstamp' => $GLOBALS['EXEC_TIME']
+               if (is_object($GLOBALS['typo3CacheManager'])) {
+                       $GLOBALS['typo3CacheManager']->getCache('cache_hash')->set(
+                               $hash,
+                               $data,
+                               array('ident_' . $ident),
+                               intval($lifetime)
                        );
-                       $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_hash', 'hash=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($hash, 'cache_hash'));
-                       $GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_hash', $insertFields);
                }
        }
 
index 2dd7538..5a3a4d1 100644 (file)
@@ -6719,23 +6719,12 @@ class t3lib_TCEmain {
 
                                                // Delete cache for selected pages:
                                        if (is_array($list_cache)) {
-                                               if (TYPO3_UseCachingFramework) {
-                                                       $pageCache = $GLOBALS['typo3CacheManager']->getCache(
-                                                               'cache_pages'
-                                                       );
-                                                       $pageSectionCache = $GLOBALS['typo3CacheManager']->getCache(
-                                                               'cache_pagesection'
-                                                       );
-
-                                                       $pageIds = $GLOBALS['TYPO3_DB']->cleanIntArray($list_cache);
-                                                       foreach ($pageIds as $pageId) {
-                                                               $pageCache->flushByTag('pageId_' . $pageId);
-                                                               $pageSectionCache->flushByTag('pageId_' . $pageId);
-                                                       }
-                                               } else {
-                                                       $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages', 'page_id IN (' . implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($list_cache)) . ')');
-                                                       $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pagesection', 'page_id IN (' . implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($list_cache)) . ')');
-
+                                               $pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
+                                               $pageSectionCache = $GLOBALS['typo3CacheManager']->getCache('cache_pagesection');
+                                               $pageIds = $GLOBALS['TYPO3_DB']->cleanIntArray($list_cache);
+                                               foreach ($pageIds as $pageId) {
+                                                       $pageCache->flushByTag('pageId_' . $pageId);
+                                                       $pageSectionCache->flushByTag('pageId_' . $pageId);
                                                }
                                        }
                                }
@@ -6807,19 +6796,13 @@ class t3lib_TCEmain {
                        case 'all':
                                if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.all')) {
 
-                                               // Clear all caching framework caches if it is initialized
+                                               // Clear all caching framework caches
                                        if (t3lib_cache::isCachingFrameworkInitialized()) {
                                                $GLOBALS['typo3CacheManager']->flushCaches();
                                        }
 
-                                               // Clear core cache tables if caching framework is not enabled for core
-                                       if (!TYPO3_UseCachingFramework) {
-                                               if (t3lib_extMgm::isLoaded('cms')) {
-                                                       $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cache_treelist');
-                                                       $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cache_pagesection');
-                                               }
-                                               $this->internal_clearPageCache();
-                                               $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cache_hash');
+                                       if (t3lib_extMgm::isLoaded('cms')) {
+                                               $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cache_treelist');
                                        }
 
                                                // Clearing additional cache tables:
@@ -6865,22 +6848,16 @@ class t3lib_TCEmain {
                                        // Delete cache for selected pages:
                                if (is_array($list_cache)) {
 
-                                       if (TYPO3_UseCachingFramework) {
-                                               $pageCache = $GLOBALS['typo3CacheManager']->getCache(
-                                                       'cache_pages'
-                                               );
-                                               $pageSectionCache = $GLOBALS['typo3CacheManager']->getCache(
-                                                       'cache_pagesection'
-                                               );
-
-                                               foreach ($list_cache as $pageId) {
-                                                       $pageCache->flushByTag('pageId_' . (int) $pageId);
-                                                       $pageSectionCache->flushByTag('pageId_' . (int) $pageId);
-                                               }
-                                       } else {
-                                               $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages', 'page_id IN (' . implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($list_cache)) . ')');
-                                               $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pagesection', 'page_id IN (' . implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($list_cache)) . ')'); // Originally, cache_pagesection was not cleared with cache_pages!
+                                       $pageCache = $GLOBALS['typo3CacheManager']->getCache(
+                                               'cache_pages'
+                                       );
+                                       $pageSectionCache = $GLOBALS['typo3CacheManager']->getCache(
+                                               'cache_pagesection'
+                                       );
 
+                                       foreach ($list_cache as $pageId) {
+                                               $pageCache->flushByTag('pageId_' . (int)$pageId);
+                                               $pageSectionCache->flushByTag('pageId_' . (int)$pageId);
                                        }
                                }
                        }
@@ -7002,21 +6979,8 @@ class t3lib_TCEmain {
         * @return      void
         */
        function internal_clearPageCache() {
-               if (TYPO3_UseCachingFramework) {
-                       if (t3lib_extMgm::isLoaded('cms')) {
-                               $GLOBALS['typo3CacheManager']->getCache('cache_pages')->flush();
-                       }
-               } else {
-                       if (t3lib_extMgm::isLoaded('cms')) {
-                               if ($GLOBALS['TYPO3_CONF_VARS']['FE']['pageCacheToExternalFiles']) {
-                                       $cacheDir = PATH_site . 'typo3temp/cache_pages';
-                                       $retVal = t3lib_div::rmdir($cacheDir, TRUE);
-                                       if (!$retVal) {
-                                               t3lib_div::sysLog('Could not remove page cache files in "' . $cacheDir . '"', 'Core/t3lib_tcemain', 2);
-                                       }
-                               }
-                               $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cache_pages');
-                       }
+               if (t3lib_extMgm::isLoaded('cms')) {
+                       $GLOBALS['typo3CacheManager']->getCache('cache_pages')->flush();
                }
        }
 
@@ -7234,4 +7198,4 @@ if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLA
        include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tcemain.php']);
 }
 
-?>
+?>
\ No newline at end of file
index ab44bf7..d503622 100644 (file)
@@ -354,15 +354,9 @@ class t3lib_tsfeBeUserAuth extends t3lib_beUserAuth {
         * @return      integer         The number of pages for this page in the table "cache_pages"
         */
        public function extGetNumberOfCachedPages($pageId) {
-               if (TYPO3_UseCachingFramework) {
-                       $pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
-                       $pageCacheEntries = $pageCache->getByTag('pageId_' . (int) $pageId);
-                       $count = count($pageCacheEntries);
-               } else {
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'cache_pages', 'page_id=' . intval($pageId));
-                       list($count) = $GLOBALS['TYPO3_DB']->sql_fetch_row($res);
-               }
-               return $count;
+               $pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
+               $pageCacheEntries = $pageCache->getByTag('pageId_' . (int)$pageId);
+               return count($pageCacheEntries);
        }
 
 
index 4ef8a88..bce97c8 100644 (file)
@@ -239,28 +239,13 @@ class t3lib_TStemplate {
         * is regenerated - at least the this->start function must be called,
         * because this will make a new portion of data in currentPageData string.
         *
-        * @return      array           Returns the unmatched array $currentPageData if found cached in "cache_pagesection". Otherwise FALSE is returned which means that the array must be generated and stored in the cache-table
+        * @return      array           Returns the unmatched array $currentPageData if found cached in "cache_pagesection". Otherwise FALSE is returned which means that the array must be generated and stored in the cache
         * @see start(), tslib_fe::getFromCache()
         */
-       function getCurrentPageData() {
-               $currentPageData = FALSE;
-               if (TYPO3_UseCachingFramework) {
-                       $pageSectionCache = $GLOBALS['typo3CacheManager']->getCache('cache_pagesection');
-                       /* @var $pageSectionCache t3lib_cache_AbstractCache */
-
-                       $currentPageData = $pageSectionCache->get(
-                               intval($GLOBALS['TSFE']->id) . '_' . t3lib_div::md5int($GLOBALS['TSFE']->MP)
-                       );
-               } else {
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-                               'content', 'cache_pagesection', 'page_id=' . intval($GLOBALS['TSFE']->id) . ' AND mpvar_hash=' . t3lib_div::md5int($GLOBALS['TSFE']->MP));
-                       if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
-                               $currentPageData = unserialize($row['content']);
-                       }
-                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
-               }
-
-               return $currentPageData;
+       public function getCurrentPageData() {
+               return $GLOBALS['typo3CacheManager']
+                       ->getCache('cache_pagesection')
+                       ->get(intval($GLOBALS['TSFE']->id) . '_' . t3lib_div::md5int($GLOBALS['TSFE']->MP));
        }
 
        /**
@@ -391,29 +376,16 @@ class t3lib_TStemplate {
 
                        if (!$isCached && !$this->simulationHiddenOrTime && !$GLOBALS['TSFE']->no_cache) { // Only save the data if we're not simulating by hidden/starttime/endtime
                                $mpvarHash = t3lib_div::md5int($GLOBALS['TSFE']->MP);
-                               if (TYPO3_UseCachingFramework) {
-                                       $pageSectionCache = $GLOBALS['typo3CacheManager']->getCache('cache_pagesection');
-                                       /* @var $pageSectionCache t3lib_cache_AbstractCache */
-                                       $pageSectionCache->set(
-                                               intval($GLOBALS['TSFE']->id) . '_' . $mpvarHash,
-                                               $cc,
-                                               array(
-                                                        'pageId_' . intval($GLOBALS['TSFE']->id),
-                                                        'mpvarHash_' . $mpvarHash
-                                               )
-                                       );
-                               } else {
-                                       $dbFields = array(
-                                               'content' => serialize($cc),
-                                               'tstamp' => $GLOBALS['EXEC_TIME']
-                                       );
-                                       $GLOBALS['TYPO3_DB']->exec_UPDATEquery('cache_pagesection', 'page_id=' . intval($GLOBALS['TSFE']->id) . ' AND mpvar_hash=' . $mpvarHash, $dbFields);
-                                       if ($GLOBALS['TYPO3_DB']->sql_affected_rows() == 0) {
-                                               $dbFields['page_id'] = intval($GLOBALS['TSFE']->id);
-                                               $dbFields['mpvar_hash'] = $mpvarHash;
-                                               $GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_pagesection', $dbFields);
-                                       }
-                               }
+                                       /** @var $pageSectionCache t3lib_cache_AbstractCache */
+                               $pageSectionCache = $GLOBALS['typo3CacheManager']->getCache('cache_pagesection');
+                               $pageSectionCache->set(
+                                       intval($GLOBALS['TSFE']->id) . '_' . $mpvarHash,
+                                       $cc,
+                                       array(
+                                               'pageId_' . intval($GLOBALS['TSFE']->id),
+                                               'mpvarHash_' . $mpvarHash
+                                       )
+                               );
                        }
                                // If everything OK.
                        if ($this->rootId && $this->rootLine && $this->setup) {
index 8859b99..c624a98 100644 (file)
@@ -150,7 +150,6 @@ $TYPO3_CONF_VARS = array(
                                )
                        )
                ),
-               'useCachingFramework' => FALSE,                 // Boolean: Enable this if you want to use the caching framework by default for the core caches cache_pages, cache_pagesection and cache_hash.
                'displayErrors' => -1,                                  // <p>Integer (-1, 0, 1, 2). Configures whether PHP errors should be displayed.</p><dl><dt>0</dt><dd>Do not display any PHP error messages. Overrides the value of "exceptionalErrors" and sets it to 0 (= no errors are turned into exceptions), the configured "productionExceptionHandler" is used as exception handler</dd><dt>1</dt><dd>Display error messages with the registered errorhandler. The configured "debugExceptionHandler" is used as exception handler</dd><dt>2</dt><dd>Display errors only if client matches <a href="#SYS-devIPmask">[SYS][devIPmask]</a>. If devIPmask matches the users IP address  the configured "debugExceptionHandler" is used  for exceptions, if not "productionExceptionHandler" will be used</dd><dt>-1</dt><dd>Default setting. With this option, you can override the PHP setting "display_errors". If devIPmask matches the users IP address  the configured "debugExceptionHandler" is used  for exceptions, if not "productionExceptionHandler" will be used.</dd></dl>
                'productionExceptionHandler'  => 't3lib_error_ProductionExceptionHandler',      // String: Classname to handle exceptions that might happen in the TYPO3-code. Leave empty to disable exception handling. Default: "t3lib_error_ProductionExceptionHandler". This exception handler displays a nice error message when something went wrong. The error message is logged to the configured logs. Note: The configured "productionExceptionHandler" is used if displayErrors is set to "0" or to "-1" and devIPmask doesn't match the users IP.
                'debugExceptionHandler' => 't3lib_error_DebugExceptionHandler',                         // String: Classname to handle exceptions that might happen in the TYPO3-code. Leave empty to disable exception handling. Default: "t3lib_error_DebugExceptionHandler". This exception handler displays the complete stack trace of any encountered exception. The error message and the stack trace  is logged to the configured logs. Note: The configured "debugExceptionHandler" is used if displayErrors is set to "1" and if displayErrors is "-1"  or "2" and the devIPmask matches the users IP.
@@ -918,8 +917,17 @@ if (TYPO3_MODE=='FE' && is_object($TT)) $TT->pull();
 
 require_once(t3lib_extMgm::extPath('lang') . 'lang.php');
 
-       // Define disposal of caching framewor for core caches:
-define('TYPO3_UseCachingFramework', (bool)$GLOBALS['TYPO3_CONF_VARS']['SYS']['useCachingFramework']);
+       // @deprecated, constant can be removed in 4.8
+define('TYPO3_UseCachingFramework', TRUE);
+       // Deprecation log since 4.6, can be removed in 4.8. Checks if obsolete useCachingFramework is set
+if (isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['useCachingFramework'])) {
+       t3lib_div::deprecationLog('Setting $GLOBALS[\'TYPO3_CONF_VARS\'][\'SYS\'][\'useCachingFramework\'] is obsolete since TYPO3 4.6 and should be removed.');
+}
+       // Deprecation log since 4.6, can be removed in 4.8. Checks if obsolete pageCacheToExternalFiles is set
+if (isset($GLOBALS['TYPO3_CONF_VARS']['FE']['pageCacheToExternalFiles'])) {
+       t3lib_div::deprecationLog('Setting $GLOBALS[\'TYPO3_CONF_VARS\'][\'FE\'][\'pageCacheToExternalFiles\'] is deprecated since TYPO3 4.6 and should be removed.');
+}
+
        // Define "TYPO3_DLOG" constant
 define('TYPO3_DLOG', $GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_DLOG']);
 
index 6495f1b..da3a126 100644 (file)
@@ -91,19 +91,6 @@ CREATE TABLE be_users (
 );
 
 #
-# Table structure for table 'cache_hash'
-#
-CREATE TABLE cache_hash (
-  id int(11) unsigned NOT NULL auto_increment,
-  hash varchar(32) DEFAULT '' NOT NULL,
-  content mediumblob,
-  tstamp int(11) unsigned DEFAULT '0' NOT NULL,
-  ident varchar(32) DEFAULT '' NOT NULL,
-  PRIMARY KEY (id),
-  KEY hash (hash)
-) ENGINE=InnoDB;
-
-#
 # Table structure for table 'cache_imagesizes'
 #
 CREATE TABLE cache_imagesizes (
index 0a6db8f..d115301 100644 (file)
@@ -227,14 +227,11 @@ $PARSETIME_START = t3lib_div::milliseconds();             // Is set to the system time in m
 // ***********************************
 // Initializing the Caching System
 // ***********************************
+t3lib_cache::initializeCachingFramework();
+t3lib_cache::initPageCache();
+t3lib_cache::initPageSectionCache();
+t3lib_cache::initContentHashCache();
 
-if (TYPO3_UseCachingFramework) {
-       t3lib_cache::initializeCachingFramework();
-
-       t3lib_cache::initPageCache();
-       t3lib_cache::initPageSectionCache();
-       t3lib_cache::initContentHashCache();
-}
 // *************************
 // CLI dispatch processing
 // *************************
index cd7f737..c5f33d6 100755 (executable)
@@ -2,37 +2,6 @@
 
 
 #
-# Table structure for table 'cache_pages'
-#
-CREATE TABLE cache_pages (
-  id int(11) unsigned NOT NULL auto_increment,
-  hash varchar(32) DEFAULT '' NOT NULL,
-  page_id int(11) unsigned DEFAULT '0' NOT NULL,
-  reg1 int(11) unsigned DEFAULT '0' NOT NULL,
-  HTML mediumblob,
-  temp_content int(1) DEFAULT '0' NOT NULL,
-  tstamp int(11) unsigned DEFAULT '0' NOT NULL,
-  expires int(10) unsigned DEFAULT '0' NOT NULL,
-  cache_data mediumblob,
-  KEY page_id (page_id),
-  KEY sel (hash,page_id),
-  PRIMARY KEY (id)
-) ENGINE=InnoDB;
-
-
-#
-# Table structure for table 'cache_pagesection'
-#
-CREATE TABLE cache_pagesection (
-  page_id int(11) unsigned DEFAULT '0' NOT NULL,
-  mpvar_hash int(11) unsigned DEFAULT '0' NOT NULL,
-  content blob,
-  tstamp int(11) unsigned DEFAULT '0' NOT NULL,
-  PRIMARY KEY (page_id,mpvar_hash)
-) ENGINE=InnoDB;
-
-
-#
 # Table structure for table 'cache_typo3temp_log'
 #
 CREATE TABLE cache_typo3temp_log (
index 54d6139..bf5cb3c 100644 (file)
                        }
                }
 
-               if (TYPO3_UseCachingFramework) {
-                       $this->initCaches();
-               }
+               $this->initCaches();
        }
 
        /**
         * @return      void
         */
        protected function initCaches() {
-               if (TYPO3_UseCachingFramework) {
-                       $GLOBALS['TT']->push('Initializing the Caching System','');
-
-                       t3lib_cache::initializeCachingFramework();
+               $GLOBALS['TT']->push('Initializing the Caching System','');
 
-                       try {
-                               $this->pageCache = $GLOBALS['typo3CacheManager']->getCache(
-                                       'cache_pages'
-                               );
-                       } catch(t3lib_cache_exception_NoSuchCache $e) {
-                               t3lib_cache::initPageCache();
+               t3lib_cache::initializeCachingFramework();
 
-                               $this->pageCache = $GLOBALS['typo3CacheManager']->getCache(
-                                       'cache_pages'
-                               );
-                       }
+               $this->pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
 
-                       t3lib_cache::initPageSectionCache();
-                       t3lib_cache::initContentHashCache();
+               t3lib_cache::initPageSectionCache();
+               t3lib_cache::initContentHashCache();
 
-                       $GLOBALS['TT']->pull();
-               }
+               $GLOBALS['TT']->pull();
        }
 
        /**
                                                }
 
                                                $this->config = (array)unserialize($row['cache_data']);         // Fetches the lowlevel config stored with the cached data
-                                               $this->content = (TYPO3_UseCachingFramework ? $row['content'] : $row['HTML']);  // Getting the content
+                                               $this->content = $row['content'];       // Getting the content
                                                $this->tempContent = $row['temp_content'];      // Flag for temp content
                                                $this->cacheContentFlag = 1;    // Setting flag, so we know, that some cached content has been loaded
                                                $this->cacheExpires = $row['expires'];
         * @return      array           Cached row, if any. Otherwise void.
         */
        function getFromCache_queryRow() {
-               if (TYPO3_UseCachingFramework) {
-                       $GLOBALS['TT']->push('Cache Query', '');
-                       $row = $this->pageCache->get($this->newHash);
-                       $GLOBALS['TT']->pull();
-               } else {
-                       $GLOBALS['TT']->push('Cache Query','');
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
-                               'S.*',
-                               'cache_pages S,pages P',
-                               'S.hash='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->newHash, 'cache_pages').'
-                                       AND S.page_id=P.uid
-                                       AND S.expires > '.intval($GLOBALS['ACCESS_TIME']).'
-                                       AND P.deleted=0
-                                       AND P.hidden=0
-                                       AND P.starttime<='.intval($GLOBALS['ACCESS_TIME']).'
-                                       AND (P.endtime=0 OR P.endtime>'.intval($GLOBALS['ACCESS_TIME']).')'
-                       );
-                       $GLOBALS['TT']->pull();
-
-                       if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
-                               $this->pageCachePostProcess($row,'get');
-                       }
-                       $GLOBALS['TYPO3_DB']->sql_free_result($res);
-               }
+               $GLOBALS['TT']->push('Cache Query', '');
+               $row = $this->pageCache->get($this->newHash);
+               $GLOBALS['TT']->pull();
                return $row;
        }
 
         * @see realPageCacheContent(), tempPageCacheContent()
         */
        function setPageCacheContent($content, $data, $expirationTstamp) {
+               $cacheData = array(
+                       'identifier'    => $this->newHash,
+                       'page_id'               => $this->id,
+                       'content'                       => $content,
+                       'temp_content'  => $this->tempContent,
+                       'cache_data'    => serialize($data),
+                       'expires'               => $expirationTstamp,
+                       'tstamp'                => $GLOBALS['EXEC_TIME']
+               );
 
-               if (TYPO3_UseCachingFramework) {
-                       $cacheData = array(
-                               'identifier'    => $this->newHash,
-                               'page_id'               => $this->id,
-                               'content'                       => $content,
-                               'temp_content'  => $this->tempContent,
-                               'cache_data'    => serialize($data),
-                               'expires'               => $expirationTstamp,
-                               'tstamp'                => $GLOBALS['EXEC_TIME']
-                       );
-
-                       $this->cacheExpires = $expirationTstamp;
-
-                       $this->pageCacheTags[] = 'pageId_' . $cacheData['page_id'];
-
-                       if ($this->page_cache_reg1) {
-                               $reg1 = intval($this->page_cache_reg1);
-
-                               $cacheData['reg1']     = $reg1;
-                               $this->pageCacheTags[] = 'reg1_' . $reg1;
-                       }
-
-                       $this->pageCache->set(
-                               $this->newHash,
-                               $cacheData,
-                               $this->pageCacheTags,
-                               $expirationTstamp - $GLOBALS['EXEC_TIME']
-                       );
-               } else {
-                       $this->clearPageCacheContent();
-                       $insertFields = array(
-                               'hash' => $this->newHash,
-                               'page_id' => $this->id,
-                               'HTML' => $content,
-                               'temp_content' => $this->tempContent,
-                               'cache_data' => serialize($data),
-                               'expires' => $expirationTstamp,
-                               'tstamp' => $GLOBALS['EXEC_TIME']
-                       );
+               $this->cacheExpires = $expirationTstamp;
 
-                       $this->cacheExpires = $expirationTstamp;
+               $this->pageCacheTags[] = 'pageId_' . $cacheData['page_id'];
 
-                       if ($this->page_cache_reg1)     {
-                               $insertFields['reg1'] = intval($this->page_cache_reg1);
-                       }
-                       $this->pageCachePostProcess($insertFields,'set');
-                       $GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_pages', $insertFields);
+               if ($this->page_cache_reg1) {
+                       $reg1 = intval($this->page_cache_reg1);
+                       $cacheData['reg1']     = $reg1;
+                       $this->pageCacheTags[] = 'reg1_' . $reg1;
                }
+
+               $this->pageCache->set(
+                       $this->newHash,
+                       $cacheData,
+                       $this->pageCacheTags,
+                       $expirationTstamp - $GLOBALS['EXEC_TIME']
+               );
        }
 
        /**
         * @return      void
         */
        function clearPageCacheContent() {
-               if (TYPO3_UseCachingFramework) {
-                       $this->pageCache->remove($this->newHash);
-               } else {
-                       $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages', 'hash='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->newHash, 'cache_pages'));
-               }
+               $this->pageCache->remove($this->newHash);
        }
 
        /**
         * @param       array           Input "cache_pages" row, passed by reference!
         * @param       string          Type of operation, either "get" or "set"
         * @return      void
+        * @deprecated since 4.6, will be removed in 4.8
         */
        function pageCachePostProcess(&$row,$type)      {
-
-               if ($this->TYPO3_CONF_VARS['FE']['pageCacheToExternalFiles'])   {
-                       $cacheFileName = PATH_site.'typo3temp/cache_pages/'.$row['hash']{0}.$row['hash']{1}.'/'.$row['hash'].'.html';
-                       switch((string)$type)   {
-                               case 'get':
-                                       $row['HTML'] = @is_file($cacheFileName) ? t3lib_div::getUrl($cacheFileName) : '<!-- CACHING ERROR, sorry -->';
-                               break;
-                               case 'set':
-                                       t3lib_div::writeFileToTypo3tempDir($cacheFileName, $row['HTML']);
-                                       $row['HTML'] = '';
-                               break;
-                       }
-               }
+               t3lib_div::logDeprecatedFunction();
        }
 
        /**
         * @return      void
         */
        function clearPageCacheContent_pidList($pidList) {
-               if (TYPO3_UseCachingFramework) {
-                       $pageIds = t3lib_div::trimExplode(',', $pidList);
-                       foreach ($pageIds as $pageId) {
-                               $this->pageCache->flushByTag('pageId_' . (int) $pageId);
-                       }
-               } else {
-                       $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages', 'page_id IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($pidList).')');
+               $pageIds = t3lib_div::trimExplode(',', $pidList);
+               foreach ($pageIds as $pageId) {
+                       $this->pageCache->flushByTag('pageId_' . (int)$pageId);
                }
        }
 
@@ -4970,4 +4893,4 @@ if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLA
        include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['tslib/class.tslib_fe.php']);
 }
 
-?>
+?>
\ No newline at end of file
index fe8f4e5..2ca34b3 100644 (file)
@@ -265,12 +265,7 @@ class tslib_feTCE  {
                $cacheCmd = intval($cacheCmd);
 
                if ($cacheCmd)  {
-                       if (TYPO3_UseCachingFramework) {
-                               $pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
-                               $pageCache->flushByTag('pageId_' . $cacheCmd);
-                       } else {
-                               $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages', 'page_id = ' . $cacheCmd);
-                       }
+                       $pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages')->flushByTag('pageId_' . $cacheCmd);
 
                        if ($cacheCmd == intval($GLOBALS['TSFE']->id)) {
                                        // Setting no_cache TRUE if the cleared-cache page is the current page!
index bc7c150..e5b4458 100755 (executable)
@@ -1291,13 +1291,9 @@ class tx_indexedsearch_modfunc1 extends t3lib_extobjbase {
                                                        $idList[] = (int)$row['page_id'];
                                                }
 
-                                               if (TYPO3_UseCachingFramework) {
-                                                       $pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
-                                                       foreach ($idList as $pageId) {
-                                                               $pageCache->flushByTag('pageId_' . $pageId);
-                                                       }
-                                               } else {
-                                                       $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages', 'page_id IN (' . implode(',', $idList) . ')');
+                                               $pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
+                                               foreach ($idList as $pageId) {
+                                                       $pageCache->flushByTag('pageId_' . $pageId);
                                                }
                                        }
                                }
diff --git a/typo3/sysext/lang/classes/cache/class.tx_lang_cache_file.php b/typo3/sysext/lang/classes/cache/class.tx_lang_cache_file.php
deleted file mode 100644 (file)
index cc1c072..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2011 Dominique Feyer <dfeyer@reelpeek.net>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *  A copy is found in the textfile GPL.txt and important notices to the license
- *  from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * Provides a simple cache based on the filesystem.
- *
- * @package    TYPO3
- * @subpackage tx_lang
- * @author     Dominique Feyer <dfeyer@reelpeek.net>
- */
-class tx_lang_cache_File extends tx_lang_cache_Abstract {
-
-       /**
-        * Get a cached value.
-        *
-        * @param  string $hash Cache hash
-        * @return bool|mixed
-        */
-       public function get($hash) {
-               $cacheFileName = $this->getCacheFilename($hash);
-               if (@is_file($cacheFileName)) {
-                       return unserialize(t3lib_div::getUrl($cacheFileName));
-               } else {
-                       return FALSE;
-               }
-       }
-
-       /**
-        * Adds a value to the cache.
-        *
-        * @throws RuntimeException
-        * @param string $hash Cache hash
-        * @param mixed $data
-        * @return tx_lang_cache_File This instance to allow method chaining
-        */
-       public function set($hash, $data) {
-               $cacheFileName = $this->getCacheFilename($hash);
-               $res = t3lib_div::writeFileToTypo3tempDir($cacheFileName, serialize($data));
-               if ($res !== NULL) {
-                       throw new RuntimeException(
-                               'TYPO3 Fatal Error: ' . $res,
-                               1270853903
-                       );
-               }
-
-               return $this;
-       }
-
-       /**
-        * Gets the cache absolute file path.
-        *
-        * @param string $hashSource Cache hash
-        * @return string
-        */
-       protected function getCacheFilename($hashSource) {
-               return PATH_site . 'typo3temp/llxml/' . $hashSource . '.cache';
-       }
-}
-
-?>
\ No newline at end of file
index 48564e1..75cd2f3 100644 (file)
@@ -66,8 +66,7 @@ class tx_lang_Factory implements t3lib_Singleton {
         * @return void
         */
        public function initialize() {
-               $cacheClass = TYPO3_UseCachingFramework ? 'tx_lang_cache_CachingFramework' : 'tx_lang_cache_File';
-               $this->cache = t3lib_div::makeInstance($cacheClass);
+               $this->cache = t3lib_div::makeInstance('tx_lang_cache_CachingFramework');
        }
 
        /**