[TASK] Move XLIFF handling to t3lib
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_cache.php
index 9ba2ddf..fa062d4 100644 (file)
@@ -2,7 +2,7 @@
 /***************************************************************
  *  Copyright notice
  *
- *  (c) 2008-2010 Ingo Renner <ingo@typo3.org>
+ *  (c) 2008-2011 Ingo Renner <ingo@typo3.org>
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -22,7 +22,6 @@
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
-
 /**
  * A cache handling helper class
  *
@@ -31,6 +30,7 @@
  * @subpackage t3lib
  */
 class t3lib_cache {
+
        /**
         * @var boolean
         */
@@ -45,8 +45,8 @@ class t3lib_cache {
        public static function initializeCachingFramework() {
                if (!self::isCachingFrameworkInitialized()) {
                        $GLOBALS['typo3CacheManager'] = t3lib_div::makeInstance('t3lib_cache_Manager');
-                       $GLOBALS['typo3CacheFactory'] = t3lib_div::makeInstance('t3lib_cache_Factory');
-                       $GLOBALS['typo3CacheFactory']->setCacheManager($GLOBALS['typo3CacheManager']);
+                       $GLOBALS['typo3CacheManager']->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']);
+                       $GLOBALS['typo3CacheFactory'] = t3lib_div::makeInstance('t3lib_cache_Factory', 'production', $GLOBALS['typo3CacheManager']);
                        self::$isCachingFrameworkInitialized = TRUE;
                }
        }
@@ -56,18 +56,10 @@ class t3lib_cache {
         *
         * @return      void
         * @author      Ingo Renner <ingo@typo3.org>
+        * @deprecated since TYPO3 4.6, will be removed in 4.8 - cacheManager->getCache() now initializes caches automatically
         */
        public static function initPageCache() {
-               try {
-                       $GLOBALS['typo3CacheFactory']->create(
-                               'cache_pages',
-                               $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_pages']['frontend'],
-                               $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_pages']['backend'],
-                               $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_pages']['options']
-                       );
-               } catch (t3lib_cache_exception_DuplicateIdentifier $e) {
-                       // do nothing, a cache_pages cache already exists
-               }
+               t3lib_div::logDeprecatedFunction();
        }
 
        /**
@@ -75,18 +67,10 @@ class t3lib_cache {
         *
         * @return      void
         * @author      Ingo Renner <ingo@typo3.org>
+        * @deprecated since TYPO3 4.6, will be removed in 4.8 - cacheManager->getCache() now initializes caches automatically
         */
        public static function initPageSectionCache() {
-               try {
-                       $GLOBALS['typo3CacheFactory']->create(
-                               'cache_pagesection',
-                               $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_pagesection']['frontend'],
-                               $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_pagesection']['backend'],
-                               $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_pagesection']['options']
-                       );
-               } catch (t3lib_cache_exception_DuplicateIdentifier $e) {
-                       // do nothing, a cache_pagesection cache already exists
-               }
+               t3lib_div::logDeprecatedFunction();
        }
 
        /**
@@ -94,18 +78,10 @@ class t3lib_cache {
         *
         * @return      void
         * @author      Ingo Renner <ingo@typo3.org>
+        * @deprecated since TYPO3 4.6, will be removed in 4.8 - cacheManager->getCache() now initializes caches automatically
         */
        public static function initContentHashCache() {
-               try {
-                       $GLOBALS['typo3CacheFactory']->create(
-                               'cache_hash',
-                               $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_hash']['frontend'],
-                               $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_hash']['backend'],
-                               $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_hash']['options']
-                       );
-               } catch (t3lib_cache_exception_DuplicateIdentifier $e) {
-                       // do nothing, a cache_hash cache already exists
-               }
+               t3lib_div::logDeprecatedFunction();
        }
 
        /**
@@ -130,18 +106,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();
        }
 }