Skip to content

Commit

Permalink
Convert some database calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
bharat committed Dec 14, 2009
1 parent cb55eea commit 8c03c7a
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions modules/gallery/models/item.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
}
}
Expand Down

0 comments on commit 8c03c7a

Please sign in to comment.