From 7cadb4b21b90864b4151481da9aba244d7083788 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Tue, 3 Mar 2009 05:59:38 +0000 Subject: Refactored the batch Api: 1) created a small batch helper class: Starting a batch call batch::operation(name, item). In the case of adding photos name = add and item is the parent of the new items. When the operation is finished the batch::end_operation(name) is called. operation and end_operation events are called. Handlers (i.e. item_created) can call batch::in_progress(name) to determine if a batch is being processed. --- core/controllers/simple_uploader.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/controllers/simple_uploader.php') diff --git a/core/controllers/simple_uploader.php b/core/controllers/simple_uploader.php index 5ae4bb2a..38eb5c38 100644 --- a/core/controllers/simple_uploader.php +++ b/core/controllers/simple_uploader.php @@ -48,7 +48,7 @@ class Simple_Uploader_Controller extends Controller { $file_validation = new Validation($_FILES); $file_validation->add_rules("file", "upload::valid", "upload::type[gif,jpg,png,flv,mp4]"); if ($file_validation->validate()) { - module::event("start_batch"); + batch::operation("add", $album); $temp_filename = upload::save("file"); $title = substr(basename($temp_filename), 10); // Skip unique identifier Kohana adds $path_info = pathinfo($temp_filename); @@ -65,7 +65,7 @@ class Simple_Uploader_Controller extends Controller { } public function finish() { - module::event("end_batch"); + batch::end_operation("add"); print json_encode(array("result" => "success")); } -- cgit v1.2.3