Issue Bug Closed

#24389speed up typoLink function by caching domain records

Simon Schaufelberger 12/22/10, 11:59 updated 05/24/22, 18:28

Description

there is a big TODO already in the comments, so if TYPO3 4.5 wants to be the fastest TYPO3 ever, this part of the typoLink function should be cached since it is called MANY times on a page…

$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
    'pid, domainName, forced',
    'sys_domain',
    'pid IN (' . implode(',', $targetPageRootlinePids) . ') ' . ' AND redirectTo=\'\' ' . $this->enableFields('sys_domain'),
    '',
    'sorting ASC'
);

// TODO maybe it makes sense to hold all sys_domain records in a cache to save additional DB querys on each typolink
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
    $foundDomains[] = preg_replace('/\/$/', '', $row['domainName']);
    if (!isset($firstFoundDomains[$row['pid']])) {
        $firstFoundDomains[$row['pid']] = preg_replace('/\/$/', '', $row['domainName']);
    }
    if ($row['forced'] && !isset($firstFoundForcedDomains[$row['pid']])) {
        $firstFoundForcedDomains[$row['pid']] = preg_replace('/\/$/', '', $row['domainName']);
    }
}

fileref: typo3\sysext\cms\tslib\class.tslib_content.php

(issue imported from #M16812)

Reviews 2