From e187c1d77887569f3113cb9191c303a53d8944b6 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Tue, 10 Nov 2020 21:58:37 +0100 Subject: Remove old OC_Hook for OC_Group events Those mappings exist and we will remove the first ones (labeled as `old`): old: `\OC_Hook::listen('OC_Group', 'pre_createGroup', array('run' => true, 'gid' => $gid));` since OC 8 (owncloud/core#12618): `$groupManager->listen('\OC\Group', 'preCreate', function ($gid) { ... });` since NC 17 (#18350): `OCP\Group\Events\BeforeGroupCreatedEvent` old: `\OC_Hook::emit('OC_User', 'post_createGroup', array('gid' => $gid->getGID()));` since OC 8 (owncloud/core#12618): `$groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $gid) { ... });` since NC 17 (#18350): `OCP\Group\Events\GroupCreatedEvent` old: `\OC_Hook::emit('OC_Group', 'pre_deleteGroup', array('run' => true, 'gid' => $group->getGID()));` since OC 8 (owncloud/core#12618): `$groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) { ... });` since NC 17 (#18350): `OCP\Group\Events\BeforeGroupDeletedEvent` old: `\OC_Hook::emit('OC_User', 'post_deleteGroup', array('gid' => $group->getGID()));` since OC 8 (owncloud/core#12618): `$groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) { ... });` since NC 17 (#18350): `OCP\Group\Events\GroupDeletedEvent` old: `\OC_Hook::emit('OC_Group', 'pre_addToGroup', array('run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID()));` since OC 8 (owncloud/core#12618): `$groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { ... });` since NC 17 (#18350): `OCP\Group\Events\BeforeUserAddedEvent` old: `\OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));` since OC 8 (owncloud/core#12618): `$groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { ... });` since NC 17 (#18350): `OCP\Group\Events\UserAddedEvent` Signed-off-by: Morris Jobke --- lib/private/Server.php | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/lib/private/Server.php b/lib/private/Server.php index 4ec90574740..1a2085fa0bc 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -433,45 +433,31 @@ class Server extends ServerContainer implements IServerContainer { $this->registerService(\OCP\IGroupManager::class, function (ContainerInterface $c) { $groupManager = new \OC\Group\Manager($this->get(IUserManager::class), $c->get(SymfonyAdapter::class), $this->get(ILogger::class)); $groupManager->listen('\OC\Group', 'preCreate', function ($gid) { - \OC_Hook::emit('OC_Group', 'pre_createGroup', ['run' => true, 'gid' => $gid]); - /** @var IEventDispatcher $dispatcher */ $dispatcher = $this->get(IEventDispatcher::class); $dispatcher->dispatchTyped(new BeforeGroupCreatedEvent($gid)); }); $groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $group) { - \OC_Hook::emit('OC_User', 'post_createGroup', ['gid' => $group->getGID()]); - /** @var IEventDispatcher $dispatcher */ $dispatcher = $this->get(IEventDispatcher::class); $dispatcher->dispatchTyped(new GroupCreatedEvent($group)); }); $groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) { - \OC_Hook::emit('OC_Group', 'pre_deleteGroup', ['run' => true, 'gid' => $group->getGID()]); - /** @var IEventDispatcher $dispatcher */ $dispatcher = $this->get(IEventDispatcher::class); $dispatcher->dispatchTyped(new BeforeGroupDeletedEvent($group)); }); $groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) { - \OC_Hook::emit('OC_User', 'post_deleteGroup', ['gid' => $group->getGID()]); - /** @var IEventDispatcher $dispatcher */ $dispatcher = $this->get(IEventDispatcher::class); $dispatcher->dispatchTyped(new GroupDeletedEvent($group)); }); $groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { - \OC_Hook::emit('OC_Group', 'pre_addToGroup', ['run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID()]); - /** @var IEventDispatcher $dispatcher */ $dispatcher = $this->get(IEventDispatcher::class); $dispatcher->dispatchTyped(new BeforeUserAddedEvent($group, $user)); }); $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { - \OC_Hook::emit('OC_Group', 'post_addToGroup', ['uid' => $user->getUID(), 'gid' => $group->getGID()]); - //Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks - \OC_Hook::emit('OC_User', 'post_addToGroup', ['uid' => $user->getUID(), 'gid' => $group->getGID()]); - /** @var IEventDispatcher $dispatcher */ $dispatcher = $this->get(IEventDispatcher::class); $dispatcher->dispatchTyped(new UserAddedEvent($group, $user)); -- cgit v1.2.3