[TASK] Program to cache frontend interface, not implementations 16/53116/13
authorClaus Due <claus@namelesscoder.net>
Sun, 4 Jun 2017 13:25:36 +0000 (15:25 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Sat, 9 Dec 2017 18:49:35 +0000 (19:49 +0100)
Instead of annotating and type-hinting specific cache
frontend implementations, TYPO3 should program to
the FrontendInterface instead. This patch corrects that.

Change-Id: Ibc8d31cf78459e700ab9fe3448a53cbe83bccc61
Resolves: #81461
References: #81432
Releases: master
Reviewed-on: https://review.typo3.org/53116
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Tested-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
12 files changed:
typo3/sysext/backend/Classes/Utility/BackendUtility.php
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Classes/DataHandling/DataHandler.php
typo3/sysext/core/Classes/Database/ReferenceIndex.php
typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php
typo3/sysext/core/Classes/Localization/LocalizationFactory.php
typo3/sysext/core/Classes/Package/PackageManager.php
typo3/sysext/core/Classes/Page/PageRenderer.php
typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php
typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapFactory.php
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php
typo3/sysext/recycler/Classes/Controller/DeletedRecordsController.php

index 6545e02..bd06437 100644 (file)
@@ -18,7 +18,7 @@ use Psr\Log\LoggerInterface;
 use TYPO3\CMS\Backend\Routing\UriBuilder;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Cache\CacheManager;
-use TYPO3\CMS\Core\Cache\Frontend\VariableFrontend;
+use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
 use TYPO3\CMS\Core\Database\Connection;
 use TYPO3\CMS\Core\Database\ConnectionPool;
 use TYPO3\CMS\Core\Database\Query\QueryBuilder;
@@ -3575,7 +3575,7 @@ class BackendUtility
     /**
      * Gets an instance of the runtime cache.
      *
-     * @return VariableFrontend
+     * @return FrontendInterface
      */
     protected static function getRuntimeCache()
     {
index a6649ba..4dee4e5 100644 (file)
@@ -838,7 +838,7 @@ class Bootstrap
         // See if the Routes.php from all active packages have been built together already
         $cacheIdentifier = 'BackendRoutesFromPackages_' . sha1((TYPO3_version . PATH_site . 'BackendRoutesFromPackages'));
 
-        /** @var $codeCache \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend */
+        /** @var $codeCache \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface */
         $codeCache = $this->getEarlyInstance(\TYPO3\CMS\Core\Cache\CacheManager::class)->getCache('cache_core');
         $routesFromPackages = [];
         if ($codeCache->has($cacheIdentifier)) {
index 0a2cceb..428ba63 100644 (file)
@@ -24,7 +24,7 @@ use Psr\Log\LoggerAwareTrait;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
 use TYPO3\CMS\Core\Cache\CacheManager;
-use TYPO3\CMS\Core\Cache\Frontend\VariableFrontend;
+use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
 use TYPO3\CMS\Core\Configuration\FlexForm\Exception\InvalidIdentifierException;
 use TYPO3\CMS\Core\Configuration\FlexForm\Exception\InvalidParentRowException;
 use TYPO3\CMS\Core\Configuration\FlexForm\Exception\InvalidParentRowLoopException;
@@ -684,7 +684,7 @@ class DataHandler implements LoggerAwareInterface
     /**
      * Runtime Cache to store and retrieve data computed for a single request
      *
-     * @var \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend
+     * @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
      */
     protected $runtimeCache = null;
 
@@ -8947,7 +8947,7 @@ class DataHandler implements LoggerAwareInterface
     /**
      * Gets an instance of the runtime cache.
      *
-     * @return VariableFrontend
+     * @return FrontendInterface
      */
     protected function getRuntimeCache()
     {
index 5720305..d34a4e6 100644 (file)
@@ -146,7 +146,7 @@ class ReferenceIndex implements LoggerAwareInterface
     /**
      * Runtime Cache to store and retrieve data computed for a single request
      *
-     * @var \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend
+     * @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
      */
     protected $runtimeCache = null;
 
index 663afb5..b7058d3 100644 (file)
@@ -2193,7 +2193,7 @@ class GraphicalFunctions
         $statusHash = $this->generateStatusHashForImageFile($filePath);
         $identifier = $this->generateCacheKeyForImageFile($filePath);
 
-        /** @var \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend $cache */
+        /** @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache */
         $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('cache_imagesizes');
         $imageDimensions = [
             'hash'        => $statusHash,
@@ -2217,7 +2217,7 @@ class GraphicalFunctions
     {
         $statusHash = $this->generateStatusHashForImageFile($filePath);
         $identifier = $this->generateCacheKeyForImageFile($filePath);
-        /** @var \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend $cache */
+        /** @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache */
         $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('cache_imagesizes');
         $cachedImageDimensions = $cache->get($identifier);
         if (!isset($cachedImageDimensions['hash'])) {
index a6263d5..aa1b08d 100644 (file)
@@ -24,7 +24,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 class LocalizationFactory implements \TYPO3\CMS\Core\SingletonInterface
 {
     /**
-     * @var \TYPO3\CMS\Core\Cache\Frontend\StringFrontend
+     * @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
      */
     protected $cacheInstance;
 
index 5d6622a..c5a423c 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Core\Package;
 
 use Symfony\Component\Finder\Finder;
 use Symfony\Component\Finder\SplFileInfo;
+use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
 use TYPO3\CMS\Core\Compatibility\LoadedExtensionArrayElement;
 use TYPO3\CMS\Core\Core\Bootstrap;
 use TYPO3\CMS\Core\Core\ClassLoadingInformation;
@@ -37,7 +38,7 @@ class PackageManager implements \TYPO3\CMS\Core\SingletonInterface
     protected $dependencyResolver;
 
     /**
-     * @var \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend
+     * @var FrontendInterface
      */
     protected $coreCache;
 
@@ -110,9 +111,9 @@ class PackageManager implements \TYPO3\CMS\Core\SingletonInterface
     }
 
     /**
-     * @param \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend $coreCache
+     * @param FrontendInterface $coreCache
      */
-    public function injectCoreCache(\TYPO3\CMS\Core\Cache\Frontend\PhpFrontend $coreCache)
+    public function injectCoreCache(FrontendInterface $coreCache)
     {
         $this->coreCache = $coreCache;
     }
index 08366cf..78021a4 100644 (file)
@@ -17,7 +17,7 @@ namespace TYPO3\CMS\Core\Page;
 use TYPO3\CMS\Backend\Routing\Router;
 use TYPO3\CMS\Backend\Routing\UriBuilder;
 use TYPO3\CMS\Core\Cache\CacheManager;
-use TYPO3\CMS\Core\Cache\Frontend\VariableFrontend;
+use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
 use TYPO3\CMS\Core\Localization\LocalizationFactory;
 use TYPO3\CMS\Core\Service\MarkerBasedTemplateService;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
@@ -1367,7 +1367,7 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface
         $loadedExtensions = ExtensionManagementUtility::getLoadedExtensionListArray();
         $isDevelopment = GeneralUtility::getApplicationContext()->isDevelopment();
         $cacheIdentifier = 'requireJS_' . md5(implode(',', $loadedExtensions) . ($isDevelopment ? ':dev' : '') . GeneralUtility::getIndpEnv('TYPO3_REQUEST_SCRIPT'));
-        /** @var VariableFrontend $cache */
+        /** @var FrontendInterface $cache */
         $cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('assets');
         $this->requireJsConfig = $cache->get($cacheIdentifier);
 
index c96a36c..9078e88 100644 (file)
@@ -1512,7 +1512,7 @@ tt_content.' . $key . $suffix . ' {
     {
         if ($allowCaching) {
             $cacheIdentifier = self::getExtLocalconfCacheIdentifier();
-            /** @var $codeCache \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend */
+            /** @var $codeCache \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface */
             $codeCache = self::getCacheManager()->getCache('cache_core');
             if ($codeCache->has($cacheIdentifier)) {
                 $codeCache->requireOnce($cacheIdentifier);
@@ -1611,7 +1611,7 @@ tt_content.' . $key . $suffix . ' {
     {
         if ($allowCaching) {
             $cacheIdentifier = static::getBaseTcaCacheIdentifier();
-            /** @var $codeCache \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend */
+            /** @var $codeCache \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface */
             $codeCache = static::getCacheManager()->getCache('cache_core');
             $cacheData = $codeCache->requireOnce($cacheIdentifier);
             if ($cacheData) {
@@ -1731,7 +1731,7 @@ tt_content.' . $key . $suffix . ' {
      */
     protected static function createBaseTcaCacheFile()
     {
-        /** @var $codeCache \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend */
+        /** @var $codeCache \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface */
         $codeCache = self::getCacheManager()->getCache('cache_core');
         $codeCache->set(
             static::getBaseTcaCacheIdentifier(),
@@ -1767,7 +1767,7 @@ tt_content.' . $key . $suffix . ' {
         if ($allowCaching && !self::$extTablesWasReadFromCacheOnce) {
             self::$extTablesWasReadFromCacheOnce = true;
             $cacheIdentifier = self::getExtTablesCacheIdentifier();
-            /** @var $codeCache \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend */
+            /** @var $codeCache \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface */
             $codeCache = self::getCacheManager()->getCache('cache_core');
             if ($codeCache->has($cacheIdentifier)) {
                 $codeCache->requireOnce($cacheIdentifier);
index 633edd0..1ab4d35 100644 (file)
@@ -42,7 +42,7 @@ class DataMapFactory implements \TYPO3\CMS\Core\SingletonInterface
     protected $cacheManager;
 
     /**
-     * @var \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend
+     * @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
      */
     protected $dataMapCache;
 
index 83fb59a..879b148 100644 (file)
@@ -815,7 +815,7 @@ class ContentObjectRenderer
         if ($cacheConfiguration !== null) {
             $key = $this->calculateCacheKey($cacheConfiguration);
             if (!empty($key)) {
-                /** @var $cacheFrontend \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend */
+                /** @var $cacheFrontend \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface */
                 $cacheFrontend = GeneralUtility::makeInstance(CacheManager::class)->getCache('cache_hash');
                 $tags = $this->calculateCacheTags($cacheConfiguration);
                 $lifetime = $this->calculateCacheLifetime($cacheConfiguration);
@@ -2861,7 +2861,7 @@ class ContentObjectRenderer
         if (empty($key)) {
             return $content;
         }
-        /** @var $cacheFrontend \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend */
+        /** @var $cacheFrontend \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface */
         $cacheFrontend = GeneralUtility::makeInstance(CacheManager::class)->getCache('cache_hash');
         $tags = $this->calculateCacheTags($conf['cache.']);
         $lifetime = $this->calculateCacheLifetime($conf['cache.']);
@@ -7084,7 +7084,7 @@ class ContentObjectRenderer
 
         $cacheKey = $this->calculateCacheKey($configuration);
         if (!empty($cacheKey)) {
-            /** @var $cacheFrontend \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend */
+            /** @var $cacheFrontend \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface */
             $cacheFrontend = GeneralUtility::makeInstance(CacheManager::class)
                 ->getCache('cache_hash');
             $content = $cacheFrontend->get($cacheKey);
index 09b9e65..b3f777c 100644 (file)
@@ -30,7 +30,7 @@ use TYPO3\CMS\Recycler\Utility\RecyclerUtility;
 class DeletedRecordsController
 {
     /**
-     * @var \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend
+     * @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
      */
     protected $runtimeCache = null;
 
@@ -199,7 +199,7 @@ class DeletedRecordsController
     /**
      * Gets an instance of the memory cache.
      *
-     * @return \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend
+     * @return \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
      */
     protected function getMemoryCache()
     {