From 6591ea25771f2ab31fea4bf3b7a6fd76c586e098 Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Sun, 21 Feb 2010 23:48:23 -0800 Subject: Fix delete() function of DB based Cache driver. It expected a scalar key / tag value, but it was always an array of keys / tags. (compare to system/libraries/Cache.php and the File.php driver) --- modules/gallery/libraries/drivers/Cache/Database.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'modules/gallery/libraries/drivers/Cache') diff --git a/modules/gallery/libraries/drivers/Cache/Database.php b/modules/gallery/libraries/drivers/Cache/Database.php index 82a09ab9..085c5c35 100644 --- a/modules/gallery/libraries/drivers/Cache/Database.php +++ b/modules/gallery/libraries/drivers/Cache/Database.php @@ -153,15 +153,17 @@ class Cache_Database_Driver extends Cache_Driver { * @param bool delete a tag * @return bool */ - public function delete($id, $tag=false) { + public function delete($keys, $is_tag=false) { $db = db::build() ->delete("caches"); - if ($id === true) { + if ($keys === true) { // Delete all caches - } else if ($tag === true) { - $db->where("tags", "LIKE", "%<$id>%"); + } else if ($is_tag === true) { + foreach ($keys as $tag) { + $db->where("tags", "LIKE", "%<$tag>%"); + } } else { - $db->where("key", "=", $id); + $db->where("key", "IN", $keys); } $status = $db->execute(); -- cgit v1.2.3 From 1d8862d957e8f08552d448cd17b3c00c61b7fc05 Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Wed, 24 Feb 2010 01:28:38 -0800 Subject: Fix for ticket #1034: Fix db cache driver delete() call which was missed in a recent refactoring / fix. --- modules/gallery/libraries/drivers/Cache/Database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gallery/libraries/drivers/Cache') diff --git a/modules/gallery/libraries/drivers/Cache/Database.php b/modules/gallery/libraries/drivers/Cache/Database.php index 085c5c35..ff982396 100644 --- a/modules/gallery/libraries/drivers/Cache/Database.php +++ b/modules/gallery/libraries/drivers/Cache/Database.php @@ -130,7 +130,7 @@ class Cache_Database_Driver extends Cache_Driver { // Make sure the expiration is valid and that the hash matches if ($cache->expiration != 0 && $cache->expiration <= time()) { // Cache is not valid, delete it now - $this->delete($cache->id); + $this->delete(array($cache->id)); } else { // Disable notices for unserializing $ER = error_reporting(~E_NOTICE); -- cgit v1.2.3