summaryrefslogtreecommitdiff
path: root/modules/gallery/models
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-09-07 21:09:52 -0700
committerBharat Mediratta <bharat@menalto.com>2009-09-07 21:09:52 -0700
commit78a42d9b8397e36bdd2a84e1fd6b4f49f0873b78 (patch)
treee02fcc189e0cc6accce7910e3e7d067b5595499b /modules/gallery/models
parentf28353f4e1c573a33dc1c3375585ab040f8be2fc (diff)
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
Diffstat (limited to 'modules/gallery/models')
-rw-r--r--modules/gallery/models/item.php13
1 files changed, 10 insertions, 3 deletions
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);
}