From 9e7761e6920e54b7e263b93ccbbadc99fdefb148 Mon Sep 17 00:00:00 2001 From: Kay Strobach Date: Sat, 8 Oct 2022 09:56:04 +0200 Subject: [PATCH] [BUGFIX] remove deprecated cache from constant viewhelper Signed-off-by: Kay Strobach --- Classes/ViewHelpers/ConstantViewHelper.php | 32 ++-------------------- 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/Classes/ViewHelpers/ConstantViewHelper.php b/Classes/ViewHelpers/ConstantViewHelper.php index 6779728..5704327 100644 --- a/Classes/ViewHelpers/ConstantViewHelper.php +++ b/Classes/ViewHelpers/ConstantViewHelper.php @@ -25,7 +25,7 @@ public function initializeArguments() { $this->registerArgument('constant', 'string', 'the constant path', false, ''); } - + /** * Gets a constant * @@ -45,43 +45,15 @@ public function initializeArguments() public function render() { $constant = $this->arguments['constant']; - + $pageWithTheme = \KayStrobach\Themes\Utilities\FindParentPageWithThemeUtility::find($this->getFrontendController()->id); $pageLanguage = (int)GeneralUtility::_GP('L'); - // instantiate the cache - /** @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache */ - $cache = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')->getCache('themes_cache'); - $cacheLifeTime = 60 * 60 * 24 * 7 * 365 * 20; - $cacheIdentifierString = 'theme-of-page-' . $pageWithTheme . '-of-language-' . $pageLanguage; - $cacheIdentifier = sha1($cacheIdentifierString); - - // If flatSetup is available, cache it $flatSetup = $this->getFrontendController()->tmpl->flatSetup; - if ((isset($flatSetup) && (is_array($flatSetup)) && (count($flatSetup) > 0))) { - $cache->set( - $cacheIdentifier, - $flatSetup, - array( - 'page-' . $this->getFrontendController()->id - ), - $cacheLifeTime - ); - } else { - $flatSetup = $cache->get($cacheIdentifier); - } // If flatSetup not available and not cached, generate it! if (!isset($flatSetup) || !is_array($flatSetup)) { $this->getFrontendController()->tmpl->generateConfig(); $flatSetup = $this->getFrontendController()->tmpl->flatSetup; - $cache->set( - $cacheIdentifier, - $flatSetup, - array( - 'page-' . $this->getFrontendController()->id - ), - $cacheLifeTime - ); } // check if there is a value and return it