summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-03-01 19:11:01 +0000
committerTim Almdal <tnalmdal@shaw.ca>2009-03-01 19:11:01 +0000
commit512a532650670fa38fd4ef79f124ce237e4474a7 (patch)
treec5230dce813e9f96ff127de5dbb535b2ef046cef /modules
parentbed1bb48f33c1c20decb6b592b1d713f5c9fb48e (diff)
Simplify the batch api by having the core event handlers for
start_batch and end_batch add and remove the batch id from the session. Modules wishing to do batch processing, just need to fire the start_batch and end_batch events. Other modules that need to be aware of batches (i.e. notifications) just check the session for "batch_id".
Diffstat (limited to 'modules')
-rw-r--r--modules/local_import/controllers/local_import.php13
1 files changed, 3 insertions, 10 deletions
diff --git a/modules/local_import/controllers/local_import.php b/modules/local_import/controllers/local_import.php
index 2b8248a4..8fc183b7 100644
--- a/modules/local_import/controllers/local_import.php
+++ b/modules/local_import/controllers/local_import.php
@@ -65,12 +65,7 @@ class Local_Import_Controller extends Controller {
}
$path = $this->input->post("path");
- $batch_id = Session::instance()->get("batch_id");
- if (empty($batch_id)) {
- $batch_id = mt_rand();
- module::event("start_add_batch", $batch_id);
- Session::instance()->set("batch_id", $batch_id);
- }
+ module::event("start_batch");
$source_path = $path[0];
for ($i = 1; $i < count($path); $i++) { // skip the first path
@@ -97,10 +92,8 @@ class Local_Import_Controller extends Controller {
}
public function finish() {
- $batch_id = Session::instance()->get_once("batch_id");
- if (!empty($batch_id)) {
- module::event("end_add_batch", $batch_id);
- }
+ module::event("end_batch");
+
print json_encode(array("result" => "success"));
}