diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-05-14 15:14:07 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-05-14 15:14:07 +0000 |
commit | d7c4d32c57d2b07b43c6fcade438d3187bb9ca08 (patch) | |
tree | 5c6502e8d6b8dc84312c3ec64a3935a13f73995e /core | |
parent | c8c82eff66d017e9a9bec8b8890285e89afcf2ec (diff) |
Fix for ticket #268
1) Added a clear method to model_cache
2) Cleared the model_cache, when the make_album_cover or
remove_album_cover is called.
Diffstat (limited to 'core')
-rw-r--r-- | core/helpers/item.php | 2 | ||||
-rw-r--r-- | core/helpers/model_cache.php | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/core/helpers/item.php b/core/helpers/item.php index f5dbc38b..b051bb0e 100644 --- a/core/helpers/item.php +++ b/core/helpers/item.php @@ -49,6 +49,7 @@ class item_Core { $parent = $item->parent(); access::required("edit", $parent); + model_cache::clear("item", $parent->album_cover_item_id); $parent->album_cover_item_id = $item->is_album() ? $item->album_cover_item_id : $item->id; $parent->thumb_dirty = 1; $parent->save(); @@ -63,6 +64,7 @@ class item_Core { access::required("edit", $album); @unlink($album->thumb_path()); + model_cache::clear("item", $album->album_cover_item_id) ; $album->album_cover_item_id = null; $album->thumb_width = 0; $album->thumb_height = 0; diff --git a/core/helpers/model_cache.php b/core/helpers/model_cache.php index f4b11a6e..2649fdbd 100644 --- a/core/helpers/model_cache.php +++ b/core/helpers/model_cache.php @@ -32,6 +32,12 @@ class model_cache_Core { return self::$cache->$model_name->$field_name->$id; } + static function clear($model_name, $id, $field_name="id") { + if (!empty(self::$cache->$model_name->$field_name->$id)) { + unset(self::$cache->$model_name->$field_name->$id); + } + } + static function set($model) { self::$cache->{$model->object_name} ->{$model->primary_key} |