diff -ruN typo3_old/t3lib/class.t3lib_page.php typo3_new/t3lib/class.t3lib_page.php --- typo3_old/t3lib/class.t3lib_page.php 2007-06-25 18:00:25.875000000 +0200 +++ typo3_new/t3lib/class.t3lib_page.php 2007-06-25 18:36:24.906250000 +0200 @@ -894,12 +894,17 @@ * @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() @@ -1204,7 +1209,7 @@ /** * Checks if user has access to workspace. - * + * * @param int $wsid Workspace ID * @return boolean true if has access */ diff -ruN typo3_old/t3lib/class.t3lib_tcemain.php typo3_new/t3lib/class.t3lib_tcemain.php --- typo3_old/t3lib/class.t3lib_tcemain.php 2007-06-25 18:00:26.046875000 +0200 +++ typo3_new/t3lib/class.t3lib_tcemain.php 2007-06-25 19:15:44.328125000 +0200 @@ -6122,6 +6122,38 @@ * ******************************/ + 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?) @@ -6200,6 +6232,8 @@ } } + $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)).')'); diff -ruN typo3_old/t3lib/stddb/tables.sql typo3_new/t3lib/stddb/tables.sql --- typo3_old/t3lib/stddb/tables.sql 2007-06-25 18:23:06.437500000 +0200 +++ typo3_new/t3lib/stddb/tables.sql 2007-06-25 18:25:10.453125000 +0200 @@ -123,10 +123,13 @@ # 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; # diff -ruN typo3_old/typo3/sysext/cms/tslib/class.tslib_menu.php typo3_new/typo3/sysext/cms/tslib/class.tslib_menu.php --- typo3_old/typo3/sysext/cms/tslib/class.tslib_menu.php 2007-06-25 18:02:52.875000000 +0200 +++ typo3_new/typo3/sysext/cms/tslib/class.tslib_menu.php 2007-06-25 18:57:21.984375000 +0200 @@ -845,7 +845,7 @@ $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); }