Index: class.tslib_content.php =================================================================== --- class.tslib_content.php (revision 7928) +++ class.tslib_content.php (working copy) @@ -219,22 +219,6 @@ require_once(t3lib_extMgm::extPath('obts').'_tsobject/_tso.php'); } - - - - - - - - - - - - - - - - /** * This class contains all main TypoScript features. * This includes the rendering of TypoScript content objects (cObjects). @@ -338,6 +322,11 @@ var $cObjHookObjectsArr = array(); // Containig hooks for userdefined cObjects protected $stdWrapHookObjects = array(); // Containing hook objects for stdWrap protected $getImgResourceHookObjects; // Containing hook objects for getImgResource + + + protected $foundDomains = NULL; // Containing sys_domain entries + protected $firstFoundDomains = NULL; // Containing sys_domain entries + protected $firstFoundForcedDomains = NULL; // Containing sys_domain entries /** * Set to true by doConvertToUserIntObject() if USER object wants to become USER_INT @@ -6091,45 +6080,55 @@ // Find all domain records in the rootline of the target page $targetPageRootline = $GLOBALS['TSFE']->sys_page->getRootLine($page['uid']); - $foundDomains = array(); - $firstFoundDomains = array(); - $firstFoundForcedDomains = array(); $targetPageRootlinePids = array(); foreach ($targetPageRootline as $data) { $targetPageRootlinePids[] = intval($data['uid']); } - $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']); + + // execute only once and save result into class variable + if (!isset($this->foundDomains) + && !isset($this->firstFoundDomains) + && !isset($this->firstFoundForcedDomains)) { + + // init + $this->foundDomains = $this->firstFoundDomains = $this->firstFoundForcedDomains = array(); + + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( + 'pid, domainName, forced', + 'sys_domain', + 'pid IN (' . implode(',', $targetPageRootlinePids) . ') ' . + ' AND redirectTo=\'\' ' . $this->enableFields('sys_domain') . + ' AND hidden = 0 ' , + '', + 'sorting ASC' + ); + + while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { + // echo '