[TASK] Avoid thousands of removeDotsFromTs in TemplatePaths 94/57294/2
authorClaus Due <claus@namelesscoder.net>
Fri, 22 Jun 2018 13:16:59 +0000 (15:16 +0200)
committerJigal van Hemert <jigal.van.hemert@typo3.org>
Sat, 23 Jun 2018 19:38:43 +0000 (21:38 +0200)
This patch avoids calling GeneralUtility::removeDotsFromTs
on the entire TS array, instead selectively calling it only on
the sub-array and only if a sub-array was actually resolved.

In my extremely small testing setup this patch avoids 1,100
calls in FE and 6,000 calls in BE (in page module with fluid
previews being rendered).

Change-Id: I7195aa310711d82de4861df8dcb2a9fbda309520
Releases: master, 8.7
Resolves: #85341
Reviewed-on: https://review.typo3.org/57294
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Fabien Udriot <fabien.udriot@ecodev.ch>
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
typo3/sysext/fluid/Classes/View/TemplatePaths.php

index 041f2aa..21d0ced 100644 (file)
@@ -31,11 +31,6 @@ use TYPO3\CMS\Extbase\Object\ObjectManager;
 class TemplatePaths extends \TYPO3Fluid\Fluid\View\TemplatePaths
 {
     /**
-     * @var array
-     */
-    protected $typoScript = [];
-
-    /**
      * @var string
      */
     protected $templateSource;
@@ -94,16 +89,14 @@ class TemplatePaths extends \TYPO3Fluid\Fluid\View\TemplatePaths
                 self::CONFIG_LAYOUTROOTPATHS => $this->layoutRootPaths,
             ];
         } else {
-            if (empty($this->typoScript)) {
-                $this->typoScript = GeneralUtility::removeDotsFromTS(
-                    (array)$this->getConfigurationManager()->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT)
-                );
-            }
+            $typoScript = (array)$this->getConfigurationManager()->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
             $signature = str_replace('_', '', $extensionKey);
-            if ($this->isBackendMode() && isset($this->typoScript['module']['tx_' . $signature]['view'])) {
-                $configuredPaths = (array)$this->typoScript['module']['tx_' . $signature]['view'];
-            } elseif ($this->isFrontendMode() && isset($this->typoScript['plugin']['tx_' . $signature]['view'])) {
-                $configuredPaths = (array)$this->typoScript['plugin']['tx_' . $signature]['view'];
+            if ($this->isBackendMode() && isset($typoScript['module.']['tx_' . $signature . '.']['view.'])) {
+                $configuredPaths = (array)$typoScript['module.']['tx_' . $signature . '.']['view.'];
+                $configuredPaths = GeneralUtility::removeDotsFromTS($configuredPaths);
+            } elseif ($this->isFrontendMode() && isset($typoScript['plugin.']['tx_' . $signature . '.']['view.'])) {
+                $configuredPaths = (array)$typoScript['plugin.']['tx_' . $signature . '.']['view.'];
+                $configuredPaths = GeneralUtility::removeDotsFromTS($configuredPaths);
             }
         }