From 8c03c7a073df7d210e1e961797cc39fd124ec390 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 13 Dec 2009 17:15:12 -0800 Subject: [PATCH] Convert some database calls. --- modules/gallery/models/item.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index 8a42cc1ee3..b6af052869 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -161,11 +161,13 @@ public function rename($new_name) { $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 @@ public function __set($column, $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)); + db::build() + ->update("items") + ->set("relative_url_cache", null) + ->where("left_ptr", ">", $this->left_ptr) + ->where("right_ptr", "<", $this->right_ptr) + ->execute(); } } }