[BUGFIX] Clear all cache in install tool throws exception 11/29811/7
authorSascha Wilking <sascha.wilking@hmmh.de>
Sat, 3 May 2014 13:06:41 +0000 (15:06 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 3 May 2014 16:43:59 +0000 (18:43 +0200)
reinitializeClassLoaderAndCachesAndPackageManagement
not only reloads the class loader and package management
but also reloads LocalConfiguratzion and
AdditionalConfiguration. This can lead to errors if
AdditionalConfiguration contains require_once calls.
The method is only used by ClearCacheService which
does not need the configuration reload.

Solution is to remove the method and introduce a new
one to unregister only the class loader. The other
bootstrap methods are now called directly in clear
cache of install tool.

Resolves: #58337
Releases: 6.2
Change-Id: I59cec5f3fc7dacbf83854c0559b4a8b3f143707d
Reviewed-on: https://review.typo3.org/29811
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Jan Runte
Tested-by: Jan Runte
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/install/Classes/Service/ClearCacheService.php

index a907831..516dd8e 100644 (file)
@@ -270,22 +270,14 @@ class Bootstrap {
        }
 
        /**
-        * Reinitializes the class loader during clear cache actions
-        * Beware! This is not public API and necessary for edge cases in the install tool
+        * Unregister class loader
         *
-        * @param string $packageManagerClassName
         * @return Bootstrap
+        * @internal This is not a public API method, do not use in own extensions
         */
-       public function reinitializeClassLoaderAndCachesAndPackageManagement($packageManagerClassName = 'TYPO3\\CMS\\Core\\Package\\PackageManager') {
+       public function unregisterClassLoader() {
                $currentClassLoader = $this->getEarlyInstance('TYPO3\\CMS\\Core\\Core\\ClassLoader');
                spl_autoload_unregister(array($currentClassLoader, 'loadClass'));
-               \TYPO3\CMS\Core\Cache\Cache::flagCachingFrameworkForReinitialization();
-               $this
-                       ->initializeClassLoader()
-                       ->populateLocalConfiguration()
-                       ->initializeCachingFramework()
-                       ->initializeClassLoaderCaches()
-                       ->initializePackageManagement($packageManagerClassName);
                return $this;
        }
 
index e1ced75..8650db3 100644 (file)
@@ -61,7 +61,15 @@ class ClearCacheService {
                GeneralUtility::rmdir(PATH_site . 'typo3temp/Cache', TRUE);
 
                $bootstrap = \TYPO3\CMS\Core\Core\Bootstrap::getInstance();
-               $bootstrap->reinitializeClassLoaderAndCachesAndPackageManagement();
+               $bootstrap->unregisterClassLoader();
+
+               \TYPO3\CMS\Core\Cache\Cache::flagCachingFrameworkForReinitialization();
+
+               $bootstrap
+                       ->initializeClassLoader()
+                       ->initializeCachingFramework()
+                       ->initializeClassLoaderCaches()
+                       ->initializePackageManagement('TYPO3\\CMS\\Core\\Package\\PackageManager');
 
                // Get all table names starting with 'cf_' and truncate them
                $database = $this->getDatabaseConnection();