Closed lochmueller closed 9 years ago
Speed up the page with many links....
diff --git a/typo3conf/ext/cooluri/class.tx_cooluri.php b/typo3conf/ext/cooluri/class.tx_cooluri.php index 6f26ff8..3bcbe4c 100644 --- a/typo3conf/ext/cooluri/class.tx_cooluri.php +++ b/typo3conf/ext/cooluri/class.tx_cooluri.php @@ -349,6 +349,12 @@ class tx_cooluri public static function getDomain($id) { + + static $domains = array(); + if(isset($domains[$id])) + return $domains[$id]; + + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('Getting domain for ' . $id, 'CoolUri'); if ($GLOBALS['TSFE']->showHiddenPage || self::isBEUserLoggedIn()) { $enable = ' AND pages.deleted=0'; @@ -369,6 +375,7 @@ class tx_cooluri if ($page['domainName'] && !$page['redirectTo']) { $resDom = preg_replace('~^.*://(.*)/?$~', '\\1', preg_replace('~/$~', '', $page['domainName'])); \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('Resolved domain: ' . $resDom, 'CoolUri'); + $domains[$id] = $resDom; return $resDom; } @@ -377,6 +384,7 @@ class tx_cooluri if ($count['num'] > 0 || $page['is_siteroot'] == 1) { \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('Domain missing for ID ' . $id . ', using HTTP_HOST ' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_HOST'), 'CoolUri'); + $domains[$id] = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_HOST'); return \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_HOST'); } @@ -385,6 +393,7 @@ class tx_cooluri --$max; } \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('Domain not found, using HTTP_HOST ' . \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_HOST'), 'CoolUri', 2); + $domains[$id] = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_HOST'); return \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_HOST'); }
Patch applied to the latest version of code.
Speed up the page with many links....