[BUGFIX] Use getPagesTSconfig($tscPID) only once per ID 81/25181/6
authorJo Hasenau <info@cybercraft.de>
Tue, 5 Nov 2013 22:34:08 +0000 (23:34 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Fri, 8 Nov 2013 15:50:09 +0000 (16:50 +0100)
PageLayoutView::isRTEforField is called on every record that is
displayed in a Web>Page. And this will call
BackendUtility::getPagesTSconfig($tscPID)
every time once and again,
and thus parsing the PageTS over and over on the same hit.
If you have 50 content elements on a page,
this can get very expensive.

Solution: Create a variable that stores the RTEsetup for
 a particular ID

Resolves: #53368
Releases: 6.2

Change-Id: I7efcefb0c12c856e9417ca8bb655acaabd4f15cc
Reviewed-on: https://review.typo3.org/25181
Reviewed-by: Oliver Klee
Reviewed-by: Jo Hasenau
Reviewed-by: Alexander Opitz
Tested-by: Alexander Opitz
Reviewed-by: Sebastian Fischer
Reviewed-by: Wouter Wolters
Reviewed-by: Peter Foerger
Tested-by: Peter Foerger
Tested-by: Philipp Gampe
Reviewed-by: Philipp Gampe
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/backend/Classes/View/PageLayoutView.php

index f0540e4..f669f0d 100644 (file)
@@ -167,6 +167,13 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
         */
        public $itemLabels = array();
 
+       /**
+        * Used to store the RTE setup of a particular page
+        *
+        * @var array
+        */
+       protected $rteSetup = array();
+
        /*****************************************
         *
         * Renderings
@@ -1740,9 +1747,11 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
                        list($tscPID, $thePidValue) = BackendUtility::getTSCpid($table, $row['uid'], $row['pid']);
                        // If the pid-value is not negative (that is, a pid could NOT be fetched)
                        if ($thePidValue >= 0) {
-                               $RTEsetup = $GLOBALS['BE_USER']->getTSConfig('RTE', BackendUtility::getPagesTSconfig($tscPID));
+                               if (!isset($this->rteSetup[$tscPID])) {
+                                       $this->rteSetup[$tscPID] = $GLOBALS['BE_USER']->getTSConfig('RTE', BackendUtility::getPagesTSconfig($tscPID));
+                               }
                                $RTEtypeVal = BackendUtility::getTCAtypeValue($table, $row);
-                               $thisConfig = BackendUtility::RTEsetup($RTEsetup['properties'], $table, $field, $RTEtypeVal);
+                               $thisConfig = BackendUtility::RTEsetup($this->rteSetup[$tscPID]['properties'], $table, $field, $RTEtypeVal);
                                if (!$thisConfig['disabled']) {
                                        return TRUE;
                                }