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. --- modules/local_import/controllers/local_import.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'modules/local_import/controllers') diff --git a/modules/local_import/controllers/local_import.php b/modules/local_import/controllers/local_import.php index 8fc183b7..ee4a4f1a 100644 --- a/modules/local_import/controllers/local_import.php +++ b/modules/local_import/controllers/local_import.php @@ -65,8 +65,8 @@ class Local_Import_Controller extends Controller { } $path = $this->input->post("path"); - module::event("start_batch"); - + batch::operation("add", $parent); + $source_path = $path[0]; for ($i = 1; $i < count($path); $i++) { // skip the first path $source_path .= "/$path[$i]"; @@ -92,7 +92,7 @@ class Local_Import_Controller extends Controller { } public function finish() { - module::event("end_batch"); + batch::end_operation("add"); print json_encode(array("result" => "success")); } -- cgit v1.2.3