Skip to content
Snippets Groups Projects
Commit 30c46719 authored by Claus Due's avatar Claus Due Committed by Andreas Fernandez
Browse files

[BUGFIX] Remove runtime cache and early return from TemplatePaths

This patch removes the previously introduced runtime cache
and early returns from TemplatePaths, both of which were
implemented in an attempt to prevent excessive TypoScript
parsing - an issue which has since been solved by optimising
the TypoScript parsing enough that a cache and early return
is no longer necessary (no longer constitutes a significant
performance increase).

The early return and caching introduced regressions described
in the related forge issues. Removing both solves those problems.

In addition, the method resolving TypoScript paths is now
covered by extensive unit tests confirming everything from
merging to sorting of template paths. An average of 8 tests
cover the method's lines. Each of the expected behaviors
is now declared as specific test.

Change-Id: Ia6d505dcec7d77ad7aaeea9094d7d85a58553c63
Resolves: #82196
Resolves: #82181
Related: #79662
Releases: master, 8.7
Reviewed-on: https://review.typo3.org/53917


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: default avatarJigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: default avatarJigal van Hemert <jigal.van.hemert@typo3.org>
Reviewed-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: default avatarStefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: default avatarAndreas Fernandez <typo3@scripting-base.de>
Tested-by: default avatarAndreas Fernandez <typo3@scripting-base.de>
parent 017f7eb4
Branches
Tags
No related merge requests found
......@@ -14,8 +14,6 @@ namespace TYPO3\CMS\Fluid\View;
* The TYPO3 project - inspiring people to share!
*/
use TYPO3\CMS\Core\Cache\CacheManager;
use TYPO3\CMS\Core\Cache\Frontend\VariableFrontend;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -79,23 +77,8 @@ class TemplatePaths extends \TYPO3Fluid\Fluid\View\TemplatePaths
if (empty($extensionKey)) {
return [];
}
$cache = $this->getRuntimeCache();
$cacheIdentifier = 'viewpaths_' . $extensionKey;
$configuration = $cache->get($cacheIdentifier);
if (is_array($configuration)) {
return $configuration;
}
$configuredPaths = [];
if (!empty($this->templateRootPaths) || !empty($this->partialRootPaths) || !empty($this->layoutRootPaths)) {
// The view was manually configured - early return to avoid caching this configuration.
return [
self::CONFIG_TEMPLATEROOTPATHS => $this->templateRootPaths,
self::CONFIG_PARTIALROOTPATHS => $this->partialRootPaths,
self::CONFIG_LAYOUTROOTPATHS => $this->layoutRootPaths,
];
}
$resources = $this->getExtensionPrivateResourcesPath($extensionKey);
$paths = [
self::CONFIG_TEMPLATEROOTPATHS => [$resources . 'Templates/'],
......@@ -121,8 +104,6 @@ class TemplatePaths extends \TYPO3Fluid\Fluid\View\TemplatePaths
}
}
$cache->set($cacheIdentifier, $paths);
return $paths;
}
......@@ -231,12 +212,4 @@ class TemplatePaths extends \TYPO3Fluid\Fluid\View\TemplatePaths
{
return TYPO3_MODE === 'FE';
}
/**
* @return VariableFrontend
*/
protected function getRuntimeCache()
{
return GeneralUtility::makeInstance(CacheManager::class)->getCache('cache_runtime');
}
}
This diff is collapsed.
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