mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-08-03 13:40:44 -04:00
Redefine the batch API to be very very simple. You call
batch::start() before starting a series of events, and batch::stop() when you're done. In batch mode, the notification module will store up pending notifications. When the batch job is complete, it'll send a single digested email to each user for all of her notifications. Updated the scaffold and local_import to use this. Haven't modified SimpleUploader yet.
This commit is contained in:
@@ -53,6 +53,10 @@ class Local_Import_Controller extends Controller {
|
||||
print $tree;
|
||||
}
|
||||
|
||||
function start() {
|
||||
batch::start();
|
||||
}
|
||||
|
||||
function add_photo($id) {
|
||||
access::verify_csrf();
|
||||
|
||||
@@ -69,11 +73,9 @@ class Local_Import_Controller extends Controller {
|
||||
throw new Exception("@todo BAD_PATH");
|
||||
}
|
||||
|
||||
batch::operation("add", $parent);
|
||||
|
||||
$source_path = $path[0];
|
||||
// The first path corresponds to the source directory so we can just skip it.
|
||||
for ($i = 1; $i < count($path); $i++) {
|
||||
for ($i = 1; $i < count($path); $i++) {
|
||||
$source_path .= "/$path[$i]";
|
||||
$pathinfo = pathinfo($source_path);
|
||||
set_time_limit(30);
|
||||
@@ -97,8 +99,7 @@ class Local_Import_Controller extends Controller {
|
||||
}
|
||||
|
||||
public function finish() {
|
||||
batch::end_operation("add");
|
||||
|
||||
batch::stop();
|
||||
print json_encode(array("result" => "success"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user