From 2787d8d843941554dc86f37680351dd9764d1f51 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 14 Apr 2011 15:09:36 +0000 Subject: [PATCH] fixed not working deleteAccount hook, constructor throws exception if called without argument --> using static method now --- notifications/inc/class.notifications.inc.php | 7 +++---- notifications/inc/class.notifications_popup.inc.php | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/notifications/inc/class.notifications.inc.php b/notifications/inc/class.notifications.inc.php index 59db29dc83..b9ce011326 100644 --- a/notifications/inc/class.notifications.inc.php +++ b/notifications/inc/class.notifications.inc.php @@ -622,10 +622,9 @@ final class notifications { */ public function deleteaccount($settings) { foreach($this->backends as $backend) { - $notification_backend = self::_appname.'_'.$backend; - $backend_obj = new $notification_backend(); - if(method_exists($backend_obj, 'deleteaccount')) { - $backend_obj->deleteaccount($settings); + $backend_hook = array(self::_appname.'_'.$backend,'deleteaccount'); + if (is_callable($backend_hook)) { + call_user_func($backend_hook,$settings); } } } diff --git a/notifications/inc/class.notifications_popup.inc.php b/notifications/inc/class.notifications_popup.inc.php index d56ef6d8f2..ca166d6089 100644 --- a/notifications/inc/class.notifications_popup.inc.php +++ b/notifications/inc/class.notifications_popup.inc.php @@ -197,8 +197,8 @@ class notifications_popup implements notifications_iface { * * @param settings array with keys account_id and new_owner (new_owner is optional) */ - public function deleteaccount($settings) { - $this->db->delete( self::_notification_table, array( + public static function deleteaccount($settings) { + $GLOBALS['egw']->db->delete( self::_notification_table, array( 'account_id' => $settings['account_id'] ),__LINE__,__FILE__,self::_appname); }