Project

General

Profile

Bug #17210 ยป cache_hash.patch

Administrator Admin, 2007-06-25 19:20

View differences:

typo3_new/t3lib/class.t3lib_page.php 2007-06-25 18:36:24.906250000 +0200
* @param string 32 bit hash string (eg. a md5 hash of a serialized array identifying the data being stored)
* @param string The data string. If you want to store an array, then just serialize it first.
* @param string $ident is just a textual identification in order to inform about the content! May be 20 characters long.
* @param string $parent_table is parent table which the cache entry is related to.
* @param integer $parent_table_uid is parent record uid of table $parent_table which the cache entry is related to.
* @return void
* @see tslib_TStemplate::start(), getHash()
*/
function storeHash($hash,$data,$ident) {
function storeHash($hash,$data,$ident,$parent_table='',$parent_table_uid='') {
$insertFields = array(
'hash' => $hash,
'parent_table' => $parent_table,
'parent_table_uid' => $parent_table_uid,
'content' => $data,
'ident' => $ident,
'tstamp' => time()
......
/**
* Checks if user has access to workspace.
*
*
* @param int $wsid Workspace ID
* @return boolean <code>true</code> if has access
*/
typo3_new/t3lib/class.t3lib_tcemain.php 2007-06-25 19:15:44.328125000 +0200
*
******************************/
function find_parent_pages($uid)
{
foreach($uid as $key=>$uid)
{
for($uid;;)
{
$record=t3lib_BEfunc::getRecord('pages',$uid,'pid');
if(sizeof($record)==0 || $record['pid']==0) break;
$uid=$record['pid'];
$results[]=$uid;
}
}
return array_unique(array_merge($uid, $results));
}
function clear_extension_cache($table,$uid,$rootline=false) {
if($rootline) {
// Find parent pages
$uid=$this->find_parent_pages($uid);
}
if(!$uid) {
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_hash',"parent_table='" . $table . "'");
}
elseif(is_array($uid)) {
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_hash',"parent_table='" . $table . "' AND parent_table_uid IN (" . implode(",", $uid) . ")");
}
else {
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_hash',"parent_table='" . $table . "' AND parent_table_uid=" . $uid);
}
}
/**
* Clearing the cache based on a page being updated
* If the $table is 'pages' then cache is cleared for all pages on the same level (and subsequent?)
......
}
}
$this->clear_extension_cache($_params['table'],$_params['pageIdArray']);
// Delete cache for selected pages:
if (is_array($list_cache)) {
$GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages','page_id IN ('.implode(',',$GLOBALS['TYPO3_DB']->cleanIntArray($list_cache)).')');
typo3_new/t3lib/stddb/tables.sql 2007-06-25 18:25:10.453125000 +0200
#
CREATE TABLE cache_hash (
hash varchar(32) DEFAULT '' NOT NULL,
parent_table varchar(255) NOT NULL,
parent_table_uid int(11) unsigned NOT NULL,
content mediumblob NOT NULL,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
ident varchar(20) DEFAULT '' NOT NULL,
PRIMARY KEY (hash)
KEY parent (parent_table,parent_table_uid)
) ENGINE=InnoDB;
#
typo3_new/typo3/sysext/cms/tslib/class.tslib_menu.php 2007-06-25 18:57:21.984375000 +0200
$serData = $this->sys_page->getHash($this->hash, $cacheTimeout);
if (!$serData) {
$this->generate();
$this->sys_page->storeHash($this->hash, serialize($this->result),'MENUDATA');
$this->sys_page->storeHash($this->hash, serialize($this->result),'MENUDATA', 'pages', $this->id);
} else {
$this->result = unserialize($serData);
}
    (1-1/1)