diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-12-13 17:15:12 -0800 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-12-13 17:15:12 -0800 |
commit | 8c03c7a073df7d210e1e961797cc39fd124ec390 (patch) | |
tree | da69a033fbaf4b1f129d16f71ecf6f36594734e2 | |
parent | cb55eea0f3609d802da5fdb0ea1c8b3acb0b8ea9 (diff) |
Convert some database calls.
-rw-r--r-- | modules/gallery/models/item.php | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index 8a42cc1e..b6af0528 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -161,11 +161,13 @@ class Item_Model extends ORM_MPTT { $this->name = $new_name; if ($this->is_album()) { - Database::instance() - ->update("items", - array("relative_path_cache" => null, - "relative_url_cache" => null), - array("left_ptr >" => $this->left_ptr, "right_ptr <" => $this->right_ptr)); + db::build() + ->update("items") + ->set("relative_url_cache", null) + ->set("relative_path_cache", null) + ->where("left_ptr", ">", $this->left_ptr) + ->where("right_ptr", "<", $this->right_ptr) + ->execute(); } return $this; @@ -362,10 +364,12 @@ class Item_Model extends ORM_MPTT { // 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)); + db::build() + ->update("items") + ->set("relative_url_cache", null) + ->where("left_ptr", ">", $this->left_ptr) + ->where("right_ptr", "<", $this->right_ptr) + ->execute(); } } } |