Follow-up to bug #11505: Extended the checks whether the caching framework was initia...
authorOliver Hader <oliver.hader@typo3.org>
Fri, 18 Sep 2009 13:35:55 +0000 (13:35 +0000)
committerOliver Hader <oliver.hader@typo3.org>
Fri, 18 Sep 2009 13:35:55 +0000 (13:35 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5981 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_cache.php

index 7cc35e1..4bd32db 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,7 @@
 2009-09-18  Oliver Hader  <oliver@typo3.org>
 
        * Follow-up to bug #11831: Removed reference operator from an object
+       * Follow-up to bug #11505: Extended the checks whether the caching framework was initialized before
 
 2009-09-18  Ingo Renner  <ingo@typo3.org>
 
index efbeeee..06ae75d 100644 (file)
@@ -34,7 +34,7 @@ class t3lib_cache {
        /**
         * @var boolean
         */
-       protected static $isCachingFrameworkInitialized;
+       protected static $isCachingFrameworkInitialized = false;
 
        /**
         * Initializes the caching framework by loading the cache manager and factory
@@ -43,10 +43,12 @@ class t3lib_cache {
         * @return      void
         */
        public static function initializeCachingFramework() {
-               $GLOBALS['typo3CacheManager'] = t3lib_div::makeInstance('t3lib_cache_Manager');
-               $GLOBALS['typo3CacheFactory'] = t3lib_div::makeInstance('t3lib_cache_Factory');
-               $GLOBALS['typo3CacheFactory']->setCacheManager($GLOBALS['typo3CacheManager']);
-               self::$isCachingFrameworkInitialized = true;
+               if (!self::isCachingFrameworkInitialized()) {
+                       $GLOBALS['typo3CacheManager'] = t3lib_div::makeInstance('t3lib_cache_Manager');
+                       $GLOBALS['typo3CacheFactory'] = t3lib_div::makeInstance('t3lib_cache_Factory');
+                       $GLOBALS['typo3CacheFactory']->setCacheManager($GLOBALS['typo3CacheManager']);
+                       self::$isCachingFrameworkInitialized = true;
+               }
        }
 
        /**
@@ -113,7 +115,14 @@ class t3lib_cache {
         * @return      boolean
         */
        public function isCachingFrameworkInitialized() {
-               return (bool)self::$isCachingFrameworkInitialized;
+               if (!self::$isCachingFrameworkInitialized
+                       && isset($GLOBALS['typo3CacheManager']) && $GLOBALS['typo3CacheManager'] instanceof t3lib_cache_Manager
+                       && isset($GLOBALS['typo3CacheFactory']) && $GLOBALS['typo3CacheFactory'] instanceof t3lib_cache_Factory
+               ) {
+                       self::$isCachingFrameworkInitialized = true;
+               }
+
+               return self::$isCachingFrameworkInitialized;
        }
 
        /**