[TASK] Do not rely on sys_page cache shortcut for fetching TSconfig 79/52179/2
authorBenni Mack <benni@typo3.org>
Mon, 27 Mar 2017 13:47:40 +0000 (15:47 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 27 Mar 2017 18:35:08 +0000 (20:35 +0200)
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>
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php

index 4c9a5c5..6a25bf3 100644 (file)
@@ -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;