[TASK] Remove leftover FLOW3 code in Caching 27/44927/4
authorBenjamin Mack <benni@typo3.org>
Tue, 24 Nov 2015 10:51:24 +0000 (11:51 +0100)
committerHelmut Hummel <helmut.hummel@typo3.org>
Tue, 24 Nov 2015 13:50:26 +0000 (14:50 +0100)
The Caching Framework has still an Exception
related to the (now removed) class loading and some
methods which depend on FLOW3 caches and classes
which were never used.

Resolves: #71799
Releases: master
Change-Id: I2f3ffbc128bff217e8d4e02a22a8648893dc0b9f
Reviewed-on: https://review.typo3.org/44927
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
typo3/sysext/core/Classes/Cache/CacheManager.php
typo3/sysext/core/Classes/Cache/Exception/ClassAlreadyLoadedException.php [deleted file]
typo3/sysext/core/Classes/Cache/last_synched_revision [deleted file]
typo3/sysext/core/Tests/Unit/Cache/Frontend/AbstractFrontendTest.php

index 549cbfb..dfce814 100644 (file)
@@ -220,125 +220,6 @@ class CacheManager implements \TYPO3\CMS\Core\SingletonInterface
     }
 
     /**
-     * TYPO3 v4 note: This method is a direct backport from FLOW3 and currently
-     * unused in TYPO3 v4 context.
-     *
-     * Flushes entries tagged with class names if their class source files have changed.
-     * Also flushes AOP proxy caches if a policy was modified.
-     *
-     * This method is used as a slot for a signal sent by the system file monitor
-     * defined in the bootstrap scripts.
-     *
-     * Note: Policy configuration handling is implemented here as well as other parts
-     * of FLOW3 (like the security framework) are not fully initialized at the
-     * time needed.
-     *
-     * @param string $fileMonitorIdentifier Identifier of the File Monitor
-     * @param array $changedFiles A list of full paths to changed files
-     * @return void
-     */
-    public function flushClassFileCachesByChangedFiles($fileMonitorIdentifier, array $changedFiles)
-    {
-        $modifiedClassNamesWithUnderscores = array();
-        $objectClassesCache = $this->getCache('FLOW3_Object_Classes');
-        $objectConfigurationCache = $this->getCache('FLOW3_Object_Configuration');
-        switch ($fileMonitorIdentifier) {
-            case 'FLOW3_ClassFiles':
-                $modifiedAspectClassNamesWithUnderscores = array();
-                foreach ($changedFiles as $pathAndFilename => $status) {
-                    $pathAndFilename = str_replace(FLOW3_PATH_PACKAGES, '', $pathAndFilename);
-                    $matches = array();
-                    if (preg_match('/[^\\/]+\\/(.+)\\/(Classes|Tests)\\/(.+)\\.php/', $pathAndFilename, $matches) === 1) {
-                        $classNameWithUnderscores = str_replace(array('/', '.'), '_', $matches[1] . '_' . ($matches[2] === 'Tests' ? 'Tests_' : '') . $matches[3]);
-                        $modifiedClassNamesWithUnderscores[$classNameWithUnderscores] = true;
-                        // If an aspect was modified, the whole code cache needs to be flushed, so keep track of them:
-                        if (substr($classNameWithUnderscores, -6, 6) === 'Aspect') {
-                            $modifiedAspectClassNamesWithUnderscores[$classNameWithUnderscores] = true;
-                        }
-                        // As long as no modified aspect was found, we are optimistic that only part of the cache needs to be flushed:
-                        if (empty($modifiedAspectClassNamesWithUnderscores)) {
-                            $objectClassesCache->remove($classNameWithUnderscores);
-                        }
-                    }
-                }
-                $flushDoctrineProxyCache = false;
-                if (!empty($modifiedClassNamesWithUnderscores)) {
-                    $reflectionStatusCache = $this->getCache('FLOW3_Reflection_Status');
-                    foreach ($modifiedClassNamesWithUnderscores as $classNameWithUnderscores => $_) {
-                        $reflectionStatusCache->remove($classNameWithUnderscores);
-                        if ($flushDoctrineProxyCache === false && preg_match('/_Domain_Model_(.+)/', $classNameWithUnderscores) === 1) {
-                            $flushDoctrineProxyCache = true;
-                        }
-                    }
-                    $objectConfigurationCache->remove('allCompiledCodeUpToDate');
-                }
-                if (!empty($modifiedAspectClassNamesWithUnderscores)) {
-                    $this->systemLogger->log('Aspect classes have been modified, flushing the whole proxy classes cache.', LOG_INFO);
-                    $objectClassesCache->flush();
-                }
-                if ($flushDoctrineProxyCache === true) {
-                    $this->systemLogger->log('Domain model changes have been detected, triggering Doctrine 2 proxy rebuilding.', LOG_INFO);
-                    $objectConfigurationCache->remove('doctrineProxyCodeUpToDate');
-                }
-                break;
-            case 'FLOW3_ConfigurationFiles':
-                $policyChangeDetected = false;
-                $routesChangeDetected = false;
-                foreach ($changedFiles as $pathAndFilename => $_) {
-                    $filename = basename($pathAndFilename);
-                    if (!in_array($filename, array('Policy.yaml', 'Routes.yaml'))) {
-                        continue;
-                    }
-                    if ($policyChangeDetected === false && $filename === 'Policy.yaml') {
-                        $this->systemLogger->log('The security policies have changed, flushing the policy cache.', LOG_INFO);
-                        $this->getCache('FLOW3_Security_Policy')->flush();
-                        $policyChangeDetected = true;
-                    } elseif ($routesChangeDetected === false && $filename === 'Routes.yaml') {
-                        $this->systemLogger->log('A Routes.yaml file has been changed, flushing the routing cache.', LOG_INFO);
-                        $this->getCache('FLOW3_Mvc_Routing_FindMatchResults')->flush();
-                        $this->getCache('FLOW3_Mvc_Routing_Resolve')->flush();
-                        $routesChangeDetected = true;
-                    }
-                }
-                $this->systemLogger->log('The configuration has changed, triggering an AOP proxy class rebuild.', LOG_INFO);
-                $objectConfigurationCache->remove('allAspectClassesUpToDate');
-                $objectConfigurationCache->remove('allCompiledCodeUpToDate');
-                $objectClassesCache->flush();
-                break;
-            case 'FLOW3_TranslationFiles':
-                foreach ($changedFiles as $pathAndFilename => $status) {
-                    $matches = array();
-                    if (preg_match('/\\/Translations\\/.+\\.xlf/', $pathAndFilename, $matches) === 1) {
-                        $this->systemLogger->log('The localization files have changed, thus flushing the I18n XML model cache.', LOG_INFO);
-                        $this->getCache('FLOW3_I18n_XmlModelCache')->flush();
-                        break;
-                    }
-                }
-                break;
-        }
-    }
-
-    /**
-     * TYPO3 v4 note: This method is a direct backport from FLOW3 and currently
-     * unused in TYPO3 v4 context.
-     *
-     * Renders a tag which can be used to mark a cache entry as "depends on this class".
-     * Whenever the specified class is modified, all cache entries tagged with the
-     * class are flushed.
-     *
-     * If an empty string is specified as class name, the returned tag means
-     * "this cache entry becomes invalid if any of the known classes changes".
-     *
-     * @param string $className The class name
-     * @return string Class Tag
-     * @api
-     */
-    public static function getClassTag($className = '')
-    {
-        return $className === '' ? \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::TAG_CLASS : \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface::TAG_CLASS . str_replace('\\', '_', $className);
-    }
-
-    /**
      * Instantiates all registered caches.
      *
      * @return void
diff --git a/typo3/sysext/core/Classes/Cache/Exception/ClassAlreadyLoadedException.php b/typo3/sysext/core/Classes/Cache/Exception/ClassAlreadyLoadedException.php
deleted file mode 100644 (file)
index 7449b57..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-namespace TYPO3\CMS\Core\Cache\Exception;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-/**
- * A "Class Already Loaded" exception
- *
- * This file is a backport from FLOW3
- *
- * @api
- */
-class ClassAlreadyLoadedException extends \TYPO3\CMS\Core\Cache\Exception
-{
-}
diff --git a/typo3/sysext/core/Classes/Cache/last_synched_revision b/typo3/sysext/core/Classes/Cache/last_synched_revision
deleted file mode 100644 (file)
index f478137..0000000
+++ /dev/null
@@ -1 +0,0 @@
-a6b474f3072ee27f24cf925aba425a47650f3295
\ No newline at end of file
index 3b81bd8..bf43378 100644 (file)
@@ -100,17 +100,6 @@ class AbstractFrontendTest extends \TYPO3\CMS\Core\Tests\UnitTestCase
     /**
      * @test
      */
-    public function getClassTagRendersTagWhichCanBeUsedToTagACacheEntryWithACertainClass()
-    {
-        $identifier = 'someCacheIdentifier';
-        $backend = $this->getMock(\TYPO3\CMS\Core\Cache\Backend\AbstractBackend::class, array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'), array(), '', false);
-        $cache = $this->getMock(\TYPO3\CMS\Core\Cache\Frontend\StringFrontend::class, array('__construct', 'get', 'set', 'has', 'remove', 'getByTag'), array($identifier, $backend));
-        $this->assertEquals('%CLASS%F3_Foo_Bar_Baz', \TYPO3\CMS\Core\Cache\CacheManager::getClassTag('F3\\Foo\\Bar\\Baz'));
-    }
-
-    /**
-     * @test
-     */
     public function invalidEntryIdentifiersAreRecognizedAsInvalid()
     {
         $identifier = 'someCacheIdentifier';