mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-07-12 18:17:42 -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:
@@ -40,6 +40,10 @@ class Simple_Uploader_Controller extends Controller {
|
||||
print $v;
|
||||
}
|
||||
|
||||
public function start() {
|
||||
batch::start();
|
||||
}
|
||||
|
||||
public function add_photo($id) {
|
||||
$album = ORM::factory("item", $id);
|
||||
access::required("edit", $album);
|
||||
@@ -48,7 +52,6 @@ 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()) {
|
||||
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,8 +68,7 @@ class Simple_Uploader_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