diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-03-04 08:51:49 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-03-04 08:51:49 +0000 |
commit | 23b0abb9742d3418484fe8d01609f6849d7960ce (patch) | |
tree | 917e2816d561036055769c1723382ab0de4f6431 /modules/notification/helpers/notification_event.php | |
parent | b493a534f2966e23eb0244654e8929320721da8e (diff) |
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.
Diffstat (limited to 'modules/notification/helpers/notification_event.php')
-rw-r--r-- | modules/notification/helpers/notification_event.php | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/modules/notification/helpers/notification_event.php b/modules/notification/helpers/notification_event.php index dde328d8..4ea0be05 100644 --- a/modules/notification/helpers/notification_event.php +++ b/modules/notification/helpers/notification_event.php @@ -52,23 +52,7 @@ class notification_event_Core { ->delete_all(); } - static function operation($name, $item) { - if ($name == "add") { - $id = Session::instance()->get("notification_batch_item_id"); - if ($id && $item->id != $id) { - notification::send_batch_add($id); - } - Session::instance()->set("notification_batch_item_id", $item->id); - } + static function batch_complete() { + notification::send_pending_notifications(); } - - static function end_operation($name) { - if ($name == "add") { - $id = Session::instance()->get_once("notification_batch_item_id"); - if ($id) { - notification::send_batch_add($id); - } - } - } - -} +}
\ No newline at end of file |