From 78a42d9b8397e36bdd2a84e1fd6b4f49f0873b78 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 7 Sep 2009 21:09:52 -0700 Subject: 1. Actually set the slug to the new value in the controllers. 2. Fix up an issue where we were crashing if there were no conflicting rows 3. Amend Item_Model so that if you change the slug, it flushes the cache for all children --- modules/gallery/models/item.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'modules/gallery/models') diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index ed1294e4..a2c49154 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -329,11 +329,18 @@ class Item_Model extends ORM_MPTT { */ public function __set($column, $value) { if ($column == "name") { - // Clear the relative path as it is no longer valid. $this->relative_path_cache = null; } else if ($column == "slug") { - // Clear the relative url as it is no longer valid. - $this->relative_url_cache = null; + if ($this->slug != $value) { + // Clear the relative url cache for this item and all children + $this->relative_url_cache = null; + if ($this->is_album()) { + Database::instance() + ->update("items", + array("relative_url_cache" => null), + array("left_ptr >" => $this->left_ptr, "right_ptr <" => $this->right_ptr)); + } + } } parent::__set($column, $value); } -- cgit v1.2.3