diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2009-07-29 16:40:01 -0700 |
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2009-07-29 16:40:01 -0700 |
| commit | 7438a9c8893a5f584df3fb6a1552262c7da39b86 (patch) | |
| tree | 41b22dfc3966d21e521ad6521e7a489622333bad /modules/gallery/models | |
| parent | ead6a61d9e96d37ca3a0aecb93d18755099e341c (diff) | |
Remove some scary debug code.
Diffstat (limited to 'modules/gallery/models')
| -rw-r--r-- | modules/gallery/models/item.php | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index 481b22bc..dcbee991 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -350,21 +350,9 @@ class Item_Model extends ORM_MPTT { if (!empty($this->changed) && $this->changed != array("view_count" => "view_count")) { $this->updated = time(); if (!$this->loaded) { - try { $this->created = $this->updated; - Kohana::log("error", "get Weight"); - $weight = ORM::factory("item") - ->select("weight") - ->orderby("weight", "DESC") - ->limit(1) - ->find_all() - ->current()->weight; - Kohana::log("error", "Weight: $weight"); - $this->weight = $weight + 1; - } catch (Exception $e) { - Kohana::log("error", $e->__toString()); - throw $e; - } + $r = ORM::factory("item")->select("MAX(weight) as max_weight")->find(); + $this->weight = $r->max_weight + 1; } else { $send_event = 1; } |
