summaryrefslogtreecommitdiff
path: root/modules/notification
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-08-28 11:42:54 -0700
committerBharat Mediratta <bharat@menalto.com>2009-08-28 11:42:54 -0700
commit16fc4465d0e773239bfe11681f7303b46e6419f0 (patch)
treefd67e408d9b3a7905553ce220ef948124d29c069 /modules/notification
parentc0c65c6fcc971b1ea9c0afb75854aec502591d56 (diff)
parent430b57578b048366f054743e47de1b66cebb574e (diff)
Merge branch 'master' of git@github.com:talmdal/gallery3
Diffstat (limited to 'modules/notification')
-rw-r--r--modules/notification/helpers/notification_event.php75
1 files changed, 47 insertions, 28 deletions
diff --git a/modules/notification/helpers/notification_event.php b/modules/notification/helpers/notification_event.php
index d1b76e93..fd667ae8 100644
--- a/modules/notification/helpers/notification_event.php
+++ b/modules/notification/helpers/notification_event.php
@@ -18,60 +18,79 @@
* 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) {}
}
static function item_created($item) {
- notification::send_item_add($item);
+ try {
+ notification::send_item_add($item);
+ } catch (Exception $e) {}
}
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) {}
}
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) {}
}
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) {}
}
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) {}
}
static function batch_complete() {
- notification::send_pending_notifications();
+ try {
+ notification::send_pending_notifications();
+ } catch (Exception $e) {}
}
static function site_menu($menu, $theme) {
- if (!user::active()->guest) {
- $item = $theme->item();
+ try {
+ if (!user::active()->guest) {
+ $item = $theme->item();
- if ($item && $item->is_album() && access::can("view", $item)) {
- $watching = notification::is_watching($item);
+ if ($item && $item->is_album() && access::can("view", $item)) {
+ $watching = notification::is_watching($item);
- $label = $watching ? t("Remove notifications") : t("Enable notifications");
+ $label = $watching ? t("Remove notifications") : t("Enable notifications");
- $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())));
+ $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())));
+ }
}
- }
+ } catch (Exception $e) {}
}
} \ No newline at end of file