Commit 9dfb8e20 authored by Tymoteusz Motylewski's avatar Tymoteusz Motylewski Committed by Helmut Hummel
Browse files

[BUGFIX] Cache in BackendConfigurationManager is not taking pageId into account

Cache in BackendConfigurationManager is not taking pageId into account
Thanks to Timo Schmidt for providing the patch.

Change-Id: I55a5eb6bda086af91c5bf3ab621754b1a04d0f1e
Fixes: #42737
Releases: 6.0, 4.7, 1.3
Reviewed-on: http://review.typo3.org/16246
Reviewed-by: Stefan Neufeind
Reviewed-by: Wouter Wolters
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
parent 507fe965
......@@ -34,7 +34,7 @@ class BackendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\Abstr
/**
* @var array
*/
protected $typoScriptSetupCache = NULL;
protected $typoScriptSetupCache = array();
/**
* Returns TypoScript Setup array from current Environment.
......@@ -42,26 +42,27 @@ class BackendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\Abstr
* @return array the raw TypoScript setup
*/
public function getTypoScriptSetup() {
if ($this->typoScriptSetupCache === NULL) {
$pageId = $this->getCurrentPageId();
if (!array_key_exists($pageId, $this->typoScriptSetupCache)) {
$template = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\TemplateService');
// do not log time-performance information
$template->tt_track = 0;
$template->init();
// Get the root line
$rootline = array();
$pageId = $this->getCurrentPageId();
if ($pageId > 0) {
/** @var $sysPage \TYPO3\CMS\Frontend\Page\PageRepository */
$sysPage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
// Get the rootline for the current page
$rootline = $sysPage->getRootLine($this->getCurrentPageId(), '', TRUE);
$rootline = $sysPage->getRootLine($pageId, '', TRUE);
}
// This generates the constants/config + hierarchy info for the template.
$template->runThroughTemplates($rootline, 0);
$template->generateConfig();
$this->typoScriptSetupCache = $template->setup;
$this->typoScriptSetupCache[$pageId] = $template->setup;
}
return $this->typoScriptSetupCache;
return $this->typoScriptSetupCache[$pageId];
}
/**
......@@ -161,4 +162,4 @@ class BackendConfigurationManager extends \TYPO3\CMS\Extbase\Configuration\Abstr
}
?>
\ No newline at end of file
?>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment