Bug #20571 » 11271_v2.diff
t3lib/class.t3lib_befunc.php (working copy) | ||
---|---|---|
* @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();
|
||
... | ... | |
$output[$c]['t3ver_stage'] = $val['t3ver_stage'];
|
||
}
|
||
}
|
||
$GLOBALS['T3_VAR']['BEgetRootLine_cache'][$pid][$clause][$workspaceOL?1:0] = $output;
|
||
return $output;
|
||
}
|
||
t3lib/class.t3lib_tcemain.php (working copy) | ||
---|---|---|
} else {
|
||
$this->moveRecord_raw($table,$uid,$destPid);
|
||
}
|
||
$this->cacheHandler($table, $uid, 'move');
|
||
} else {
|
||
$this->newlog("Move attempt failed due to workspace restrictions: ".implode(' // ',$workspaceAccessBlocked),1);
|
||
}
|
||
} else { // Live workspace - move it!
|
||
$this->moveRecord_raw($table,$uid,$destPid);
|
||
$this->cacheHandler($table, $uid, 'move');
|
||
}
|
||
} else {
|
||
$this->log($table,$uid,4,0,1,"Attempt to move record '%s' (%s) without having permissions to insert.",14,array($propArr['header'],$table.':'.$uid),$propArr['event_pid']);
|
||
... | ... | |
$this->deleteVersionsForRecord($table,$uid,$forceHardDelete);
|
||
$this->deleteRecord($table, $uid, $noRecordCheck, $forceHardDelete);
|
||
}
|
||
$this->cacheHandler($table, $uid, 'delete');
|
||
}
|
||
/**
|
||
... | ... | |
// Set History data:
|
||
$this->setHistory($table,$id,$theLogId);
|
||
// Clear cache for relevant pages:
|
||
$this->clear_cache($table,$id);
|
||
// Clear cache
|
||
$this->cacheHandler($table, $id, 'update');
|
||
|
||
// Unset the pageCache for the id if table was page.
|
||
if ($table=='pages') unset($this->pageCache[$id]);
|
||
} else {
|
||
... | ... | |
$page_propArr = $this->getRecordProperties('pages',$propArr['pid']);
|
||
$this->log($table,$id,1,0,0,"Record '%s' (%s) was inserted on page '%s' (%s)",10,array($propArr['header'],$table.':'.$id,$page_propArr['header'],$newRow['pid']),$newRow['pid'],$NEW_id);
|
||
// Clear cache for relavant pages:
|
||
$this->clear_cache($table,$id);
|
||
// Clear cache
|
||
$this->cacheHandler($table, $id, 'create');
|
||
}
|
||
return $id;
|
||
... | ... | |
}
|
||
/**
|
||
* Clears specific cache depending on table and action
|
||
*
|
||
* @param string $table Table name of record that was just updated.
|
||
* @param mixed $uid UID of updated record
|
||
* @param mixed $action identifier for the database action (move, delete, update or create)
|
||
*
|
||
* @return void
|
||
*/
|
||
protected function cacheHandler($table, $uid, $action) {
|
||
switch ($table) {
|
||
case 'pages':
|
||
if (in_array($action, array('move', 'delete', 'update', 'create'))){
|
||
// clear cache for BEgetRootLine
|
||
$GLOBALS['typo3CacheManager']->getCache('cache_hash')->flushByTag('ident_BEgetRootLine');
|
||
// Clear cache for relevant pages:
|
||
$this->clear_cache($table, $uid);
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
... | ... | |
/*****************************
|
||
*
|
||
* Logging
|
typo3/sysext/setup/mod/index.php (working copy) | ||
---|---|---|
global $BE_USER,$LANG,$BACK_PATH,$TBE_MODULES;
|
||
if ($this->languageUpdate) {
|
||
// clear cache for BEgetRootLine
|
||
$GLOBALS['typo3CacheManager']->getCache('cache_hash')->flushByTag('ident_BEgetRootLine');
|
||
|
||
$this->doc->JScodeArray['languageUpdate'] .= '
|
||
if (top.refreshMenu) {
|
||
top.refreshMenu();
|