Project

General

Profile

Actions

Bug #53370

closed

Cache getPagesTSconfig per ID and rootline

Added by Jo Hasenau about 11 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Must have
Category:
Performance
Target version:
Start date:
2013-11-06
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.4
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

During the discussion of #53368 the idea came up to improve the behaviour of \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig. If a proper memory cache would be used there, the whole parsing would be done only once per request for a certain page ID and rootline.


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #53368: Use getPagesTSconfig($tscPID) only once per IDClosed2013-11-06

Actions
Related to TYPO3 Core - Bug #63629: High memory consumption in BackendUtility::getPagesTSconfig while using the DataHandlerClosed2014-12-06

Actions
Actions #1

Updated by Jo Hasenau about 11 years ago

static public function getPagesTSconfig($id, $rootLine = '', $returnPartArray = 0) {
        $id = intval($id);
        if (!is_array($rootLine)) {
            $rootLine = self::BEgetRootLine($id, '', TRUE);
        }
        // Order correctly
        ksort($rootLine);
        $TSdataArray = array();
        // Setting default configuration
        $TSdataArray['defaultPageTSconfig'] = $GLOBALS['TYPO3_CONF_VARS']['BE']['defaultPageTSconfig'];
        foreach ($rootLine as $k => $v) {
            $TSdataArray['uid_' . $v['uid']] = $v['TSconfig'];
        }
        $TSdataArray = TypoScriptParser::checkIncludeLines_array($TSdataArray);
        if ($returnPartArray) {
            return $TSdataArray;
        }
        // Parsing the page TS-Config
        $pageTS = implode(LF . '[GLOBAL]' . LF, $TSdataArray);
        /* @var $parseObj \TYPO3\CMS\Backend\Configuration\TsConfigParser */
        $parseObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Configuration\\TsConfigParser');
        $res = $parseObj->parseTSconfig($pageTS, 'PAGES', $id, $rootLine);
        if ($res) {
            $TSconfig = $res['TSconfig'];
        }
        // Get User TSconfig overlay
        $userTSconfig = $GLOBALS['BE_USER']->userTS['page.'];
        if (is_array($userTSconfig)) {
            $TSconfig = GeneralUtility::array_merge_recursive_overrule($TSconfig, $userTSconfig);
        }
        return $TSconfig;
    }

While parseTSconfig already should make use of a cache, which is not working properly at the moment, we could still improve this method by creating TSconfig only once per request. This does not have to make use of the fully fledged caching framework but could use a variable to return it early.

This way we could get rid of having to do array_merge_recursive_overrule umpteen times during a single request.

Actions #2

Updated by Georg Ringer about 11 years ago

  • Subject changed from Cahe getPagesTSconfig per ID and rootline to Cache getPagesTSconfig per ID and rootline
Actions #3

Updated by Georg Ringer almost 10 years ago

  • Status changed from New to Resolved

resolved with #63629

Actions #4

Updated by Riccardo De Contardi about 7 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF