diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-08-17 12:56:05 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-08-17 12:56:05 -0700 |
commit | 6f6d5b306b3ad673eedc08116a651c53e27fcd1f (patch) | |
tree | 4134109f493df4b38459e18d095cee892e37d784 | |
parent | 69d1b168189541fbdf2c91e30e59dbd96f600921 (diff) |
remove the batch start/stop and replace the ORM update of the weight, with a direct sql update. This bypasses the gallery3 event mechanism. Fire a album_rearrange event when the rearrangement is complete
-rw-r--r-- | modules/organize/controllers/organize.php | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/modules/organize/controllers/organize.php b/modules/organize/controllers/organize.php index c418136b..7d6b651e 100644 --- a/modules/organize/controllers/organize.php +++ b/modules/organize/controllers/organize.php @@ -173,9 +173,7 @@ class Organize_Controller extends Controller { $weight = $task->get("weight"); $target_id = $task->get("target_id"); $is_before = $task->get("before") == "before"; - if ($task->percent_complete == 0) { - batch::start(); - } + // @todo at some point if we allow drag from album tree this needs to be changed if ($phase == "dropping") { $children = ORM::factory("item") @@ -211,8 +209,9 @@ class Organize_Controller extends Controller { $task->set("phase", "dropping"); break; } - $child->weight = item::get_max_weight(); - $child->save(); + Database::instance()->query( + "UPDATE {items} SET `weight` = " . item::get_max_weight() . + " WHERE `id` = " . $child->id); $completed++; if ($phase == "before_drop" && $child->id == $task->get("target_id")) { @@ -222,9 +221,10 @@ class Organize_Controller extends Controller { } } if ($completed == $task->get("total")) { - $parent->sort_column = "weight"; - $parent->save(); - batch::stop(); + Database::instance()->query( + "UPDATE {items} SET `sort_column` = \"weight\"" . + " WHERE `id` = " . $parent->id); + module::event("album_rearrange", $parent); $task->done = true; $task->state = "success"; $task->set("content", self::_get_micro_thumb_grid($parent, 0)->__toString()); |