diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-07-10 18:25:23 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-07-10 18:25:23 -0700 |
commit | b20f9123dc0cc4bc70597910e12eb18ec0eef2c2 (patch) | |
tree | 018ff152509c15d9a36d4f96a6f0930b3f3e1a11 /modules/gallery/controllers/quick.php | |
parent | b7cd2f73c55d600935548abb1282444a592e20a0 (diff) |
Wrap album deletes in a batch so that we can handle lots of cascading
deletes in bulk. This lets us avoid the problem where we continually
choose and delete album covers which makes deletes really slow. It
probably also avoids huge amounts of notification emails (untested).
Fixes ticket #1190.
Diffstat (limited to 'modules/gallery/controllers/quick.php')
-rw-r--r-- | modules/gallery/controllers/quick.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/modules/gallery/controllers/quick.php b/modules/gallery/controllers/quick.php index 52f15e7d..08a33138 100644 --- a/modules/gallery/controllers/quick.php +++ b/modules/gallery/controllers/quick.php @@ -116,7 +116,16 @@ class Quick_Controller extends Controller { } $parent = $item->parent(); - $item->delete(); + + if ($item->is_album()) { + // Album delete will trigger deletes for all children. Do this in a batch so that we can be + // smart about notifications, album cover updates, etc. + batch::start(); + $item->delete(); + batch::stop(); + } else { + $item->delete(); + } message::success($msg); $from_id = Input::instance()->get("from_id"); |