fixed another trigger recursion when updating a cache record

function touchCache() in lib/clicompatbase.inc.php updated e.g. cache_desc.last_modified
in the same statement with an access to caches table. As the cacheDescAfterUpdate trigger
updates caches.listing_last_modified, the read & write access to caches table collided.

function touchCache() is obsolete, as touching on status change is done by triggers
for all depending tables (via SQL function sp_touch_cache).
This commit is contained in:
following
2013-03-22 09:53:49 +01:00
parent 9661614ea0
commit 252019f52d
6 changed files with 10 additions and 17 deletions

View File

@@ -81,16 +81,6 @@
sql("UPDATE `caches` SET `last_found`='&1' WHERE `cache_id`=&2", $r['date'], $cacheid);
}
// update last_modified=NOW() for every object depending on that cacheid
function touchCache($cacheid)
{
sql("UPDATE `caches` SET `last_modified`=NOW() WHERE `cache_id`='&1'", $cacheid);
sql("UPDATE `caches`, `cache_logs` SET `cache_logs`.`last_modified`=NOW() WHERE `caches`.`cache_id`=`cache_logs`.`cache_id` AND `caches`.`cache_id`='&1'", $cacheid);
sql("UPDATE `caches`, `cache_desc` SET `cache_desc`.`last_modified`=NOW() WHERE `caches`.`cache_id`=`cache_desc`.`cache_id` AND `caches`.`cache_id`='&1'", $cacheid);
sql("UPDATE `caches`, `pictures` SET `pictures`.`last_modified`=NOW() WHERE `caches`.`cache_id`=`pictures`.`object_id` AND `pictures`.`object_type`=2 AND `caches`.`cache_id`='&1'", $cacheid);
sql("UPDATE `caches`, `cache_logs`, `pictures` SET `pictures`.`last_modified`=NOW() WHERE `caches`.`cache_id`=`cache_logs`.`cache_id` AND `cache_logs`.`id`=`pictures`.`object_id` AND `pictures`.`object_type`=1 AND `caches`.`cache_id`='&1'", $cacheid);
}
// read a file and return it as a string
// WARNING: no huge files!
function read_file($file='')