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:
Bharat Mediratta
2009-03-04 08:51:49 +00:00
parent b493a534f2
commit 23b0abb974
10 changed files with 138 additions and 98 deletions
+4 -6
View File
@@ -201,8 +201,7 @@ class Scaffold_Controller extends Template_Controller {
throw new Exception("@todo BAD_ALBUM");
}
batch::operation("add", $parent);
batch::start();
cookie::set("add_photos_path", $path);
$photo_count = 0;
foreach (glob("$path/*.[Jj][Pp][Gg]") as $file) {
@@ -210,7 +209,7 @@ class Scaffold_Controller extends Template_Controller {
photo::create($parent, $file, basename($file), basename($file));
$photo_count++;
}
batch::end_operation("add");
batch::stop();
if ($photo_count > 0) {
log::success("content", "(scaffold) Added $photo_count photos",
@@ -227,8 +226,7 @@ class Scaffold_Controller extends Template_Controller {
$test_images = glob(APPPATH . "tests/images/*.[Jj][Pp][Gg]");
batch::operation("add", ORM::factory("item", 1));
batch::start();
$album_count = $photo_count = 0;
for ($i = 0; $i < $count; $i++) {
set_time_limit(30);
@@ -252,7 +250,7 @@ class Scaffold_Controller extends Template_Controller {
$photo_count++;
}
}
batch::end_operation("add");
batch::stop();
if ($photo_count > 0) {
log::success("content", "(scaffold) Added $photo_count photos");