Fixed bug #15586: Unecessary require_once in t3lib_cache_Factory (Thanks to Helmut...
authorSteffen Kamper <info@sk-typo3.de>
Sat, 28 Aug 2010 17:30:36 +0000 (17:30 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Sat, 28 Aug 2010 17:30:36 +0000 (17:30 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@8718 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/cache/class.t3lib_cache_factory.php
t3lib/config_default.php
tests/t3lib/cache/t3lib_cache_factoryTest.php

index 4edbd53..d90fc3f 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 2010-08-28  Steffen Kamper  <steffen@typo3.org>
 
+       * Fixed bug #15586: Unecessary require_once in t3lib_cache_Factory (Thanks to Helmut Hummel)
        * Fixed bug #15574: t3lib_extmgmTest::getExtensionVersionForLoadedExtensionReturnsExtensionVersion fails (Thanks to Peter Kühn)
 
 2010-08-28  Francois Suter  <francois@typo3.org>
index e143246..165e654 100644 (file)
@@ -71,15 +71,22 @@ class t3lib_cache_Factory implements t3lib_Singleton {
         */
        public function create($cacheIdentifier, $cacheName, $backendName, array $backendOptions = array()) {
 
-                       // loading the cache backend file and class
-               list($backendFile, $backendClassReference) = explode(
-                       ':',
-                       $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheBackends'][$backendName]
-               );
-
-               $backendRequireFile = t3lib_div::getFileAbsFileName($backendFile);
-               if ($backendRequireFile) {
-                       t3lib_div::requireOnce($backendRequireFile);
+               $backendReference = $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheBackends'][$backendName];
+
+               if (strpos($backendReference, ':') === FALSE) {
+                       $backendClassReference = $backendReference;
+               } else {
+                       t3lib_div::deprecationLog("Configuring cacheBackend with filename is deprecated since TYPO3 4.5. Use the autoloader instead.");
+                               // loading the cache backend file and class
+                       list($backendFile, $backendClassReference) = explode(
+                               ':',
+                               $backendReference
+                       );
+
+                       $backendRequireFile = t3lib_div::getFileAbsFileName($backendFile);
+                       if ($backendRequireFile) {
+                               t3lib_div::requireOnce($backendRequireFile);
+                       }
                }
 
                $backend = t3lib_div::makeInstance($backendClassReference, $backendOptions);
@@ -91,17 +98,23 @@ class t3lib_cache_Factory implements t3lib_Singleton {
                        );
                }
 
-                       // loading the cache frontend file and class
-               list($cacheFile, $cacheClassReference) = explode(
-                       ':',
-                       $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheFrontends'][$cacheName]
-               );
+               $cacheReference = $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheFrontends'][$cacheName];
 
-               $cacheRequireFile = t3lib_div::getFileAbsFileName($cacheFile);
-               if ($cacheRequireFile) {
-                       t3lib_div::requireOnce($cacheRequireFile);
-               }
+               if (strpos($cacheReference, ':') === FALSE) {
+                       $cacheClassReference = $cacheReference;
+               } else {
+                       t3lib_div::deprecationLog("Configuring cacheFrontends with filename is deprecated since TYPO3 4.5. Use the autoloader instead.");
+                               // loading the cache frontend file and class
+                       list($cacheFile, $cacheClassReference) = explode(
+                               ':',
+                               $cacheReference
+                       );
 
+                       $cacheRequireFile = t3lib_div::getFileAbsFileName($cacheFile);
+                       if ($cacheRequireFile) {
+                               t3lib_div::requireOnce($cacheRequireFile);
+                       }
+               }
                $cache = t3lib_div::makeInstance($cacheClassReference, $cacheIdentifier, $backend);
 
 
index 79f1875..b2c80fe 100644 (file)
@@ -108,19 +108,19 @@ $TYPO3_CONF_VARS = array(
                'reverseProxyPrefixSSL' => '',                          // String: prefix to be added to the internal URL (SCRIPT_NAME and REQUEST_URI) when accessing the server via an SSL proxy. This setting overrides <a href="#SYS-reverseProxyPrefix">[SYS][reverseProxyPrefix]</a>.
                'caching' => array(
                        'cacheFrontends' => array(
-                               't3lib_cache_frontend_VariableFrontend' => 't3lib/cache/frontend/class.t3lib_cache_frontend_variablefrontend.php:t3lib_cache_frontend_VariableFrontend',
-                               't3lib_cache_frontend_StringFrontend'   => 't3lib/cache/frontend/class.t3lib_cache_frontend_stringfrontend.php:t3lib_cache_frontend_StringFrontend',
-                               't3lib_cache_frontend_PhpFrontend'      => 't3lib/cache/frontend/class.t3lib_cache_frontend_phpfrontend.php:t3lib_cache_frontend_PhpFrontend',
+                               't3lib_cache_frontend_VariableFrontend' => 't3lib_cache_frontend_VariableFrontend',
+                               't3lib_cache_frontend_StringFrontend'   => 't3lib_cache_frontend_StringFrontend',
+                               't3lib_cache_frontend_PhpFrontend'      => 't3lib_cache_frontend_PhpFrontend',
                        ),
                        'cacheBackends' => array(
-                               't3lib_cache_backend_DbBackend'              => 't3lib/cache/backend/class.t3lib_cache_backend_dbbackend.php:t3lib_cache_backend_DbBackend',
-                               't3lib_cache_backend_FileBackend'            => 't3lib/cache/backend/class.t3lib_cache_backend_filebackend.php:t3lib_cache_backend_FileBackend',
-                               't3lib_cache_backend_GlobalsBackend'         => 't3lib/cache/backend/class.t3lib_cache_backend_globalsbackend.php:t3lib_cache_backend_GlobalsBackend',
-                               't3lib_cache_backend_MemcachedBackend'       => 't3lib/cache/backend/class.t3lib_cache_backend_memcachedbackend.php:t3lib_cache_backend_MemcachedBackend',
-                               't3lib_cache_backend_PdoBackend'             => 't3lib/cache/backend/class.t3lib_cache_backend_pdobackend.php:t3lib_cache_backend_PdoBackend',
-                               't3lib_cache_backend_ApcBackend'             => 't3lib/cache/backend/class.t3lib_cache_backend_apcbackend.php:t3lib_cache_backend_ApcBackend',
-                               't3lib_cache_backend_NullBackend'            => 't3lib/cache/backend/class.t3lib_cache_backend_nullbackend.php:t3lib_cache_backend_NullBackend',
-                               't3lib_cache_backend_TransientMemoryBackend' => 't3lib/cache/backend/class.t3lib_cache_backend_transientmemorybackend.php:t3lib_cache_backend_TransientMemoryBackend',
+                               't3lib_cache_backend_DbBackend'              => 't3lib_cache_backend_DbBackend',
+                               't3lib_cache_backend_FileBackend'            => 't3lib_cache_backend_FileBackend',
+                               't3lib_cache_backend_GlobalsBackend'         => 't3lib_cache_backend_GlobalsBackend',
+                               't3lib_cache_backend_MemcachedBackend'       => 't3lib_cache_backend_MemcachedBackend',
+                               't3lib_cache_backend_PdoBackend'             => 't3lib_cache_backend_PdoBackend',
+                               't3lib_cache_backend_ApcBackend'             => 't3lib_cache_backend_ApcBackend',
+                               't3lib_cache_backend_NullBackend'            => 't3lib_cache_backend_NullBackend',
+                               't3lib_cache_backend_TransientMemoryBackend' => 't3lib_cache_backend_TransientMemoryBackend',
                        ),
                        'cacheConfigurations' => array(
                                'cache_hash' => array(
index 400bc47..eb1221b 100644 (file)
@@ -22,6 +22,8 @@
 *  This copyright notice MUST APPEAR in all copies of the script!
 ***************************************************************/
 
+require_once 'backend/class.t3lib_cache_backend_mockbackend.php';
+
 /**
  * Testcase for the Cache Factory
  *
@@ -41,7 +43,7 @@ class t3lib_cache_FactoryTest extends tx_phpunit_testcase {
         * @author Ingo Renner <ingo@typo3.org>
         */
        public function setUp() {
-               $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheBackends']['t3lib_cache_backend_MockBackend'] = 'tests/t3lib/cache/backend/class.t3lib_cache_backend_mockbackend.php:t3lib_cache_backend_MockBackend';
+               $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheBackends']['t3lib_cache_backend_MockBackend'] = 't3lib_cache_backend_MockBackend';
        }
 
        /**