Permalink
Browse files

Convert some database calls.

  • Loading branch information...
1 parent cb55eea commit 8c03c7a073df7d210e1e961797cc39fd124ec390 @bharat bharat committed Dec 14, 2009
Showing with 13 additions and 9 deletions.
  1. +13 −9 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();
}
}
}

0 comments on commit 8c03c7a

Please sign in to comment.