From 5a3e81604068f81e244208eaf722a9faf7355fc5 Mon Sep 17 00:00:00 2001 From: Benni Mack <benni@typo3.org> Date: Mon, 27 Mar 2017 15:47:40 +0200 Subject: [PATCH] [TASK] Do not rely on sys_page cache shortcut for fetching TSconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The TypoScript Frontend Controller has a unnecessary dependency to a static call (which is made non-static !) of PageRepository which can be done exactly 1:1 by instantiating the cacheManager and fetching the "cache_hash" cache directly by storing and fetching the contents itself. Resolves: #80480 Releases: master Change-Id: If6f5976a6c07ea754915b9c612264d733a6b1a41 Reviewed-on: https://review.typo3.org/52179 Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Frank Nägler <frank.naegler@typo3.org> Reviewed-by: Andreas Fernandez <typo3@scripting-base.de> Tested-by: Frank Nägler <frank.naegler@typo3.org> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> --- .../Controller/TypoScriptFrontendController.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php index 4c9a5c5fdb8c..6a25bf32e527 100644 --- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php +++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php @@ -4215,15 +4215,14 @@ class TypoScriptFrontendController // Parsing the user TS (or getting from cache) $TSdataArray = TypoScriptParser::checkIncludeLines_array($TSdataArray); $userTS = implode(LF . '[GLOBAL]' . LF, $TSdataArray); - $hash = md5('pageTS:' . $userTS); - $cachedContent = $this->sys_page->getHash($hash); - if (is_array($cachedContent)) { - $this->pagesTSconfig = $cachedContent; - } else { + $identifier = md5('pageTS:' . $userTS); + $contentHashCache = GeneralUtility::makeInstance(CacheManager::class)->getCache('cache_hash'); + $this->pagesTSconfig = $contentHashCache->get($identifier); + if (!is_array($this->pagesTSconfig)) { $parseObj = GeneralUtility::makeInstance(TypoScriptParser::class); $parseObj->parse($userTS); $this->pagesTSconfig = $parseObj->setup; - $this->sys_page->storeHash($hash, $this->pagesTSconfig, 'PAGES_TSconfig'); + $contentHashCache->set($identifier, $this->pagesTSconfig, ['PAGES_TSconfig'], 0); } } return $this->pagesTSconfig; -- GitLab