diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 8707a8537..a8b0b8757 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -32,6 +32,7 @@ use OCA\Activity\DataHelper; use OCA\Activity\GroupHelper; use OCA\Activity\FilesHooks; +use OCA\Activity\Hooks; use OCA\Activity\MailQueueHandler; use OCA\Activity\Navigation; use OCA\Activity\Parameter\Factory; @@ -287,7 +288,8 @@ public function registerHooksAndEvents() { $eventDispatcher = $this->getContainer()->getServer()->getEventDispatcher(); $eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', ['OCA\Activity\FilesHooksStatic', 'onLoadFilesAppScripts']); - Util::connectHook('OC_User', 'post_deleteUser', 'OCA\Activity\Hooks', 'deleteUser'); + $activityHook = new Hooks(); + $eventDispatcher->addListener('user.afterdelete', [$activityHook, 'deleteUser']); $this->registerFilesActivity(); } diff --git a/lib/Hooks.php b/lib/Hooks.php index f822e57bf..d9158dfc9 100755 --- a/lib/Hooks.php +++ b/lib/Hooks.php @@ -23,6 +23,7 @@ use OCA\Activity\AppInfo\Application; use OCP\IDBConnection; +use Symfony\Component\EventDispatcher\GenericEvent; /** * Handles the stream and mail queue of a user when he is being deleted @@ -33,10 +34,10 @@ class Hooks { * * @param array $params The hook params */ - static public function deleteUser($params) { + static public function deleteUser(GenericEvent $params) { $connection = \OC::$server->getDatabaseConnection(); - self::deleteUserStream($params['uid']); - self::deleteUserMailQueue($connection, $params['uid']); + self::deleteUserStream($params->getArgument('uid')); + self::deleteUserMailQueue($connection, $params->getArgument('uid')); } /**