diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-11-01 10:22:56 -0800 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-11-01 10:22:56 -0800 |
commit | 376eb5673fd9cbc06abf308a04f83231de1a1d11 (patch) | |
tree | f240f33cc832a5bea3836a39334b7d56b06784d2 /modules/comment | |
parent | 808fd4d3a0f38a2ea80bb8d56e1f8c6ce499e42d (diff) |
Convert the event handlers for the "identity provider changed" and "user_deleted" events to use ORM or the Kohana query builder to build the database update calls instead of coding the sql directly.
Diffstat (limited to 'modules/comment')
-rw-r--r-- | modules/comment/helpers/comment_event.php | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/modules/comment/helpers/comment_event.php b/modules/comment/helpers/comment_event.php index ddf72e3c..a72102b9 100644 --- a/modules/comment/helpers/comment_event.php +++ b/modules/comment/helpers/comment_event.php @@ -24,23 +24,24 @@ class comment_event_Core { static function user_deleted($user) { $guest = identity::guest(); - Database::instance() - ->query("UPDATE {comments} - SET author_id = {$guest->id}, - guest_email = NULL, - guest_name = 'guest', - guest_url = NULL - WHERE author_id = {$user->id}"); + Database::instance()->from("comments") + ->set(array("author_id" => $guest->id, + "guest_email" => null, + "guest_name" => "guest", + "guest_url" => null)) + ->where(array("author_id" => $user->id)) + ->update(); } static function identity_provider_changed($old_provider, $new_provider) { $guest = identity::guest(); - Database::instance() - ->query("UPDATE {comments} - SET author_id = {$guest->id}, - guest_email = NULL, - guest_name = 'guest', - guest_url = null"); + Database::instance()->from("comments") + ->set(array("author_id" => $guest->id, + "guest_email" => null, + "guest_name" => "guest", + "guest_url" => null)) + ->where("1 = 1") + ->update(); } static function admin_menu($menu, $theme) { |