From b20f9123dc0cc4bc70597910e12eb18ec0eef2c2 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 10 Jul 2010 18:25:23 -0700 Subject: 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. --- modules/gallery/controllers/quick.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'modules/gallery/controllers/quick.php') 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"); -- cgit v1.2.3