diff options
Diffstat (limited to 'modules/notification')
-rw-r--r-- | modules/notification/helpers/notification.php | 26 | ||||
-rw-r--r-- | modules/notification/helpers/notification_event.php | 32 |
2 files changed, 29 insertions, 29 deletions
diff --git a/modules/notification/helpers/notification.php b/modules/notification/helpers/notification.php index 9a40b0b9..e9fc3f33 100644 --- a/modules/notification/helpers/notification.php +++ b/modules/notification/helpers/notification.php @@ -24,8 +24,8 @@ class notification { } return ORM::factory("subscription") - ->where("item_id", $item_id) - ->where("user_id", $user->id) + ->where("item_id", "=", $item_id) + ->where("user_id", "=", $user->id) ->find(); } @@ -35,10 +35,10 @@ class notification { } return ORM::factory("subscription") - ->where("item_id", $item->id) - ->where("user_id", $user->id) + ->where("item_id", "=", $item->id) + ->where("user_id", "=", $user->id) ->find() - ->loaded; + ->loaded(); } static function add_watch($item, $user=null) { @@ -60,8 +60,8 @@ class notification { } $subscription = ORM::factory("subscription") - ->where("item_id", $item->id) - ->where("user_id", $user->id) + ->where("item_id", "=", $item->id) + ->where("user_id", "=", $user->id) ->find()->delete(); } } @@ -71,8 +71,8 @@ class notification { foreach (ORM::factory("subscription") ->select("user_id") ->join("items", "subscriptions.item_id", "items.id") - ->where("items.left_ptr <=", $item->left_ptr) - ->where("items.right_ptr >", $item->right_ptr) + ->where("items.left_ptr", "<=", $item->left_ptr) + ->where("items.right_ptr", ">", $item->right_ptr) ->find_all() ->as_array() as $subscriber) { $subscriber_ids[] = $subscriber->user_id; @@ -170,13 +170,13 @@ class notification { } static function send_pending_notifications() { - foreach (Database::instance() - ->select("DISTINCT email") + foreach (db::build() + ->select(new Database_Expression("DISTINCT `email`")) ->from("pending_notifications") - ->get() as $row) { + ->execute() as $row) { $email = $row->email; $result = ORM::factory("pending_notification") - ->where("email", $email) + ->where("email", "=", $email) ->find_all(); if ($result->count() == 1) { $pending = $result->current(); diff --git a/modules/notification/helpers/notification_event.php b/modules/notification/helpers/notification_event.php index 6b2df574..951e6e52 100644 --- a/modules/notification/helpers/notification_event.php +++ b/modules/notification/helpers/notification_event.php @@ -25,8 +25,8 @@ class notification_event_Core { try { notification::send_item_updated($new); } catch (Exception $e) { - Kohana::log("error", "@todo notification_event::item_updated() failed"); - Kohana::Log("error", $e->getMessage() . "\n" . $e->getTraceAsString()); + Kohana_Log::add("error", "@todo notification_event::item_updated() failed"); + Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString()); } } @@ -34,8 +34,8 @@ class notification_event_Core { try { notification::send_item_add($item); } catch (Exception $e) { - Kohana::log("error", "@todo notification_event::item_created() failed"); - Kohana::Log("error", $e->getMessage() . "\n" . $e->getTraceAsString()); + Kohana_Log::add("error", "@todo notification_event::item_created() failed"); + Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString()); } } @@ -47,14 +47,14 @@ class notification_event_Core { notification::remove_watch($item); } } catch (Exception $e) { - Kohana::log("error", "@todo notification_event::item_deleted() failed"); - Kohana::Log("error", $e->getMessage() . "\n" . $e->getTraceAsString()); + Kohana_Log::add("error", "@todo notification_event::item_deleted() failed"); + Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString()); } } static function user_deleted($user) { ORM::factory("subscriptions") - ->where(array("user_id", $user->id)) + ->where("user_id", "=", $user->id) ->delete_all(); } @@ -69,8 +69,8 @@ class notification_event_Core { notification::send_comment_published($comment); } } catch (Exception $e) { - Kohana::log("error", "@todo notification_event::comment_created() failed"); - Kohana::Log("error", $e->getMessage() . "\n" . $e->getTraceAsString()); + Kohana_Log::add("error", "@todo notification_event::comment_created() failed"); + Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString()); } } @@ -80,19 +80,19 @@ class notification_event_Core { notification::send_comment_published($new); } } catch (Exception $e) { - Kohana::log("error", "@todo notification_event::comment_updated() failed"); - Kohana::Log("error", $e->getMessage() . "\n" . $e->getTraceAsString()); + Kohana_Log::add("error", "@todo notification_event::comment_updated() failed"); + Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString()); } } static function user_before_delete($user) { try { ORM::factory("subscription") - ->where("user_id", $user->id) + ->where("user_id", "=", $user->id) ->delete_all(); } catch (Exception $e) { - Kohana::log("error", "@todo notification_event::user_before_delete() failed"); - Kohana::Log("error", $e->getMessage() . "\n" . $e->getTraceAsString()); + Kohana_Log::add("error", "@todo notification_event::user_before_delete() failed"); + Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString()); } } @@ -100,8 +100,8 @@ class notification_event_Core { try { notification::send_pending_notifications(); } catch (Exception $e) { - Kohana::log("error", "@todo notification_event::batch_complete() failed"); - Kohana::Log("error", $e->getMessage() . "\n" . $e->getTraceAsString()); + Kohana_Log::add("error", "@todo notification_event::batch_complete() failed"); + Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString()); } } |