diff options
| author | Chad Kieffer <ckieffer@gmail.com> | 2009-08-18 23:08:32 -0600 |
|---|---|---|
| committer | Chad Kieffer <ckieffer@gmail.com> | 2009-08-18 23:08:32 -0600 |
| commit | 3b8323d5b4db4904aba9ea2f922140ab235dd681 (patch) | |
| tree | d61e7e2fef9d9aa58389b0cd6c83cb148e85644d /modules/gallery/models | |
| parent | bb6bf17076eff74ee490d17b510150d68f5faa54 (diff) | |
| parent | 67d770fb2a417359526923712899e8d799363bef (diff) | |
Merge branch 'master' of git@github.com:gallery/gallery3
Diffstat (limited to 'modules/gallery/models')
| -rw-r--r-- | modules/gallery/models/item.php | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index c4b9826f..7a3a2ba7 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -351,14 +351,7 @@ class Item_Model extends ORM_MPTT { $this->updated = time(); if (!$this->loaded) { $this->created = $this->updated; - // Guard against an empty result when we create the first item. It's unfortunate that we - // have to check this every time. - // @todo: figure out a better way to bootstrap the weight. - $result = Database::instance() - ->select("weight")->from("items") - ->orderby("weight", "desc")->limit(1) - ->get()->current(); - $this->weight = ($result ? $result->weight : 0) + 1; + $this->weight = item::get_max_weight(); } else { $send_event = 1; } |
