From e207ea61fc87d381331b73fcb4033e63626ed94e Mon Sep 17 00:00:00 2001 From: Claus Due <claus@namelesscoder.net> Date: Sun, 4 Jun 2017 15:25:36 +0200 Subject: [PATCH] [TASK] Program to cache frontend interface, not implementations 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> --- typo3/sysext/backend/Classes/Utility/BackendUtility.php | 4 ++-- typo3/sysext/core/Classes/Core/Bootstrap.php | 2 +- typo3/sysext/core/Classes/DataHandling/DataHandler.php | 6 +++--- typo3/sysext/core/Classes/Database/ReferenceIndex.php | 2 +- typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php | 4 ++-- .../core/Classes/Localization/LocalizationFactory.php | 2 +- typo3/sysext/core/Classes/Package/PackageManager.php | 7 ++++--- typo3/sysext/core/Classes/Page/PageRenderer.php | 4 ++-- .../core/Classes/Utility/ExtensionManagementUtility.php | 8 ++++---- .../Classes/Persistence/Generic/Mapper/DataMapFactory.php | 2 +- .../Classes/ContentObject/ContentObjectRenderer.php | 6 +++--- .../Classes/Controller/DeletedRecordsController.php | 4 ++-- 12 files changed, 26 insertions(+), 25 deletions(-) diff --git a/typo3/sysext/backend/Classes/Utility/BackendUtility.php b/typo3/sysext/backend/Classes/Utility/BackendUtility.php index 6545e024c03e..bd0643752ce0 100644 --- a/typo3/sysext/backend/Classes/Utility/BackendUtility.php +++ b/typo3/sysext/backend/Classes/Utility/BackendUtility.php @@ -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() { diff --git a/typo3/sysext/core/Classes/Core/Bootstrap.php b/typo3/sysext/core/Classes/Core/Bootstrap.php index a6649baddb5c..4dee4e5d7912 100644 --- a/typo3/sysext/core/Classes/Core/Bootstrap.php +++ b/typo3/sysext/core/Classes/Core/Bootstrap.php @@ -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)) { diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php index 0a2ccebdca63..428ba63a8d8a 100644 --- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php +++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php @@ -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() { diff --git a/typo3/sysext/core/Classes/Database/ReferenceIndex.php b/typo3/sysext/core/Classes/Database/ReferenceIndex.php index 57203057fb35..d34a4e671bc2 100644 --- a/typo3/sysext/core/Classes/Database/ReferenceIndex.php +++ b/typo3/sysext/core/Classes/Database/ReferenceIndex.php @@ -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; diff --git a/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php b/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php index 663afb5eb8d6..b7058d3298a1 100644 --- a/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php +++ b/typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php @@ -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'])) { diff --git a/typo3/sysext/core/Classes/Localization/LocalizationFactory.php b/typo3/sysext/core/Classes/Localization/LocalizationFactory.php index a6263d521150..aa1b08dc2aa6 100644 --- a/typo3/sysext/core/Classes/Localization/LocalizationFactory.php +++ b/typo3/sysext/core/Classes/Localization/LocalizationFactory.php @@ -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; diff --git a/typo3/sysext/core/Classes/Package/PackageManager.php b/typo3/sysext/core/Classes/Package/PackageManager.php index 5d6622ab096c..c5a423c334f9 100644 --- a/typo3/sysext/core/Classes/Package/PackageManager.php +++ b/typo3/sysext/core/Classes/Package/PackageManager.php @@ -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; } diff --git a/typo3/sysext/core/Classes/Page/PageRenderer.php b/typo3/sysext/core/Classes/Page/PageRenderer.php index 08366cf1c8c7..78021a4f4ada 100644 --- a/typo3/sysext/core/Classes/Page/PageRenderer.php +++ b/typo3/sysext/core/Classes/Page/PageRenderer.php @@ -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); diff --git a/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php b/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php index c96a36c93285..9078e88e37dc 100644 --- a/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php +++ b/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php @@ -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); diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapFactory.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapFactory.php index 633edd05f3c7..1ab4d35f84d2 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapFactory.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapFactory.php @@ -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; diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php index 83fb59abd341..879b148a2899 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php @@ -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); diff --git a/typo3/sysext/recycler/Classes/Controller/DeletedRecordsController.php b/typo3/sysext/recycler/Classes/Controller/DeletedRecordsController.php index 09b9e65ddb3e..b3f777c3d8d7 100644 --- a/typo3/sysext/recycler/Classes/Controller/DeletedRecordsController.php +++ b/typo3/sysext/recycler/Classes/Controller/DeletedRecordsController.php @@ -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() { -- GitLab