Index: t3lib/class.t3lib_befunc.php =================================================================== --- t3lib/class.t3lib_befunc.php (revision 5556) +++ t3lib/class.t3lib_befunc.php (working copy) @@ -568,9 +568,36 @@ * @return array Root line array, all the way to the page tree root (or as far as $clause allows!) */ public static function BEgetRootLine($uid, $clause = '', $workspaceOL = FALSE) { - if (is_array($GLOBALS['T3_VAR']['BEgetRootLine_cache'][$uid][$clause][$workspaceOL?1:0])) { - return $GLOBALS['T3_VAR']['BEgetRootLine_cache'][$uid][$clause][$workspaceOL?1:0]; + static $firstLevelCache = array(); + + $identifier = md5($uid . $clause . ($workspaceOL ? 1 : 0)); + // look up in first level cache + if (!empty($firstLevelCache[$identifier])) { + $array = $firstLevelCache[$identifier]; + } else { + // look up in second level cache + $array = $GLOBALS['typo3CacheManager']->getCache('cache_hash')->get($identifier); + if ($array === false) { + $array = self::processBEgetRootLine($uid, $clause, $workspaceOL); + // store content in second level cache + $GLOBALS['typo3CacheManager']->getCache('cache_hash')->set($identifier, $array, array('ident_BEgetRootLine'), 0); + } + // store content in first level cache + $firstLevelCache[$identifier] = $array; } + return $array; + + } + + /** + * process BEgetRootLine if no cache entry was found + * + * @param integer Page id for which to create the root line. + * @param string $clause can be used to select other criteria. It would typically be where-clauses that stops the process if we meet a page, the user has no reading access to. + * @param boolean If true, version overlay is applied. This must be requested specifically because it is usually only wanted when the rootline is used for visual output while for permission checking you want the raw thing! + * @return array Root line array, all the way to the page tree root (or as far as $clause allows!) + */ + protected function processBEgetRootLine($uid, $clause = '', $workspaceOL = FALSE) { $pid = $uid; $loopCheck = 100; $theRowArray = Array(); @@ -619,8 +646,6 @@ $output[$c]['t3ver_stage'] = $val['t3ver_stage']; } } - $GLOBALS['T3_VAR']['BEgetRootLine_cache'][$pid][$clause][$workspaceOL?1:0] = $output; - return $output; }