diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-06-29 20:53:55 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-06-29 20:53:55 -0700 |
commit | 77a78b49909f9d2ca598871f0588497837cb9f6a (patch) | |
tree | 0cbeb749b6f8847b1c31a3c5e194dfee41e3913a /modules/gallery/libraries/drivers | |
parent | df17d576ab111b2a71337e486f9631eb16bad4b6 (diff) |
Revert to serializing and deserializing data. The cache table can't
accept PHP constructs like arrays (the tests were choking on this).
Update tests to reflect the new `key` column.
Diffstat (limited to 'modules/gallery/libraries/drivers')
-rw-r--r-- | modules/gallery/libraries/drivers/Cache/Database.php | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/modules/gallery/libraries/drivers/Cache/Database.php b/modules/gallery/libraries/drivers/Cache/Database.php index f3a1eb02..43f4e38a 100644 --- a/modules/gallery/libraries/drivers/Cache/Database.php +++ b/modules/gallery/libraries/drivers/Cache/Database.php @@ -68,11 +68,13 @@ class Cache_Database_Driver implements Cache_Driver { } if ($this->exists($id)) { - $status = $this->db->update("caches", - array("tags" => $tags, "expiration" => $lifetime, "cache" => $data), array("key" => $id)); + $status = $this->db->update( + "caches", + array("tags" => $tags, "expiration" => $lifetime, "cache" => serialize($data)), array("key" => $id)); } else { - $status = $this->db->insert("caches", - array("key" => $id, "tags" => $tags, "expiration" => $lifetime, "cache" => $data)); + $status = $this->db->insert( + "caches", + array("key" => $id, "tags" => $tags, "expiration" => $lifetime, "cache" => serialize($data))); } return count($status) > 0; @@ -99,7 +101,7 @@ class Cache_Database_Driver implements Cache_Driver { foreach ($db_result as $row) { // Add each cache to the array - $result[$row->id] = $row->cache; + $result[$row->key] = unserialize($row->cache); } // Turn notices back on @@ -131,7 +133,7 @@ class Cache_Database_Driver implements Cache_Driver { $ER = error_reporting(~E_NOTICE); // Return the valid cache data - $data = $cache->cache; + $data = unserialize($cache->cache); // Turn notices back on error_reporting($ER); |