diff options
author | Chad Kieffer <ckieffer@gmail.com> | 2009-08-28 13:48:54 -0600 |
---|---|---|
committer | Chad Kieffer <ckieffer@gmail.com> | 2009-08-28 13:48:54 -0600 |
commit | 5a2853bca1ea9a9231e01814df9aa373bf50d19c (patch) | |
tree | 431264bfb9de1d8bbdc6a9ba7775a363381f96e8 /modules/notification/helpers/notification_event.php | |
parent | f1e008a14f2dfb51d1204dad3deb19e2e3df16c8 (diff) | |
parent | 6dcfdb6432d556f43736d60de8f310f247868bfa (diff) |
Merge branch 'master' of git@github.com:gallery/gallery3
Diffstat (limited to 'modules/notification/helpers/notification_event.php')
-rw-r--r-- | modules/notification/helpers/notification_event.php | 65 |
1 files changed, 48 insertions, 17 deletions
diff --git a/modules/notification/helpers/notification_event.php b/modules/notification/helpers/notification_event.php index d1b76e93..8fbeda92 100644 --- a/modules/notification/helpers/notification_event.php +++ b/modules/notification/helpers/notification_event.php @@ -18,42 +18,73 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class notification_event_Core { + // The assumption is that the exception was logged at a lower level, but we + // don't want to screw up the processing that was generating the notification + // so we don't pass the exception up the call stack static function item_updated($original, $new) { - notification::send_item_updated($new); + try { + notification::send_item_updated($new); + } catch (Exception $e) { + Kohana::log("error", "@todo notification_event::item_updated() failed"); + } } static function item_created($item) { - notification::send_item_add($item); + try { + notification::send_item_add($item); + } catch (Exception $e) { + Kohana::log("error", "@todo notification_event::item_created() failed"); + } } static function item_deleted($item) { - notification::send_item_deleted($item); + try { + notification::send_item_deleted($item); - if (notification::is_watching($item)) { - notification::remove_watch($item); + if (notification::is_watching($item)) { + notification::remove_watch($item); + } + } catch (Exception $e) { + Kohana::log("error", "@todo notification_event::item_deleted() failed"); } } static function comment_created($comment) { - if ($comment->state == "published") { - notification::send_comment_published($comment); + try { + if ($comment->state == "published") { + notification::send_comment_published($comment); + } + } catch (Exception $e) { + Kohana::log("error", "@todo notification_event::comment_created() failed"); } } static function comment_updated($original, $new) { - if ($new->state == "published" && $original->state != "published") { - notification::send_comment_published($new); + try { + if ($new->state == "published" && $original->state != "published") { + notification::send_comment_published($new); + } + } catch (Exception $e) { + Kohana::log("error", "@todo notification_event::comment_updated() failed"); } } static function user_before_delete($user) { - ORM::factory("subscription") - ->where("user_id", $user->id) - ->delete_all(); + try { + ORM::factory("subscription") + ->where("user_id", $user->id) + ->delete_all(); + } catch (Exception $e) { + Kohana::log("error", "@todo notification_event::user_before_delete() failed"); + } } static function batch_complete() { - notification::send_pending_notifications(); + try { + notification::send_pending_notifications(); + } catch (Exception $e) { + Kohana::log("error", "@todo notification_event::batch_complete() failed"); + } } static function site_menu($menu, $theme) { @@ -67,10 +98,10 @@ class notification_event_Core { $menu->get("options_menu") ->append(Menu::factory("link") - ->id("watch") - ->label($label) - ->css_id("gNotifyLink") - ->url(url::site("notification/watch/$item->id?csrf=" . access::csrf_token()))); + ->id("watch") + ->label($label) + ->css_id("gNotifyLink") + ->url(url::site("notification/watch/$item->id?csrf=" . access::csrf_token()))); } } } |