From 4a7d7e446f8598b07fde4db787abc4cf432e9413 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 30 Jul 2020 10:14:12 +0200 Subject: [PATCH] User.php: rename of old dispatcher to legacyDispatcher Signed-off-by: Morris Jobke --- lib/private/User/User.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/private/User/User.php b/lib/private/User/User.php index 199ddb569dd..2d27b204d09 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -64,10 +64,10 @@ class User implements IUser { /** @var UserInterface|null */ private $backend; /** @var EventDispatcherInterface */ - private $dispatcher; + private $legacyDispatcher; /** @var IEventDispatcher */ - private $newDispatcher; + private $dispatcher; /** @var bool */ private $enabled; @@ -93,7 +93,7 @@ class User implements IUser { public function __construct(string $uid, ?UserInterface $backend, EventDispatcherInterface $dispatcher, $emitter = null, IConfig $config = null, $urlGenerator = null) { $this->uid = $uid; $this->backend = $backend; - $this->dispatcher = $dispatcher; + $this->legacyDispatcher = $dispatcher; $this->emitter = $emitter; if (is_null($config)) { $config = \OC::$server->getConfig(); @@ -107,7 +107,7 @@ class User implements IUser { $this->urlGenerator = \OC::$server->getURLGenerator(); } // TODO: inject - $this->newDispatcher = \OC::$server->query(IEventDispatcher::class); + $this->dispatcher = \OC::$server->query(IEventDispatcher::class); } /** @@ -211,7 +211,7 @@ class User implements IUser { * @return bool */ public function delete() { - $this->dispatcher->dispatch(IUser::class . '::preDelete', new GenericEvent($this)); + $this->legacyDispatcher->dispatch(IUser::class . '::preDelete', new GenericEvent($this)); if ($this->emitter) { $this->emitter->emit('\OC\User', 'preDelete', [$this]); } @@ -227,9 +227,9 @@ class User implements IUser { foreach ($groupManager->getUserGroupIds($this) as $groupId) { $group = $groupManager->get($groupId); if ($group) { - $this->newDispatcher->dispatchTyped(new BeforeUserRemovedEvent($group, $this)); + $this->dispatcher->dispatchTyped(new BeforeUserRemovedEvent($group, $this)); $group->removeUser($this); - $this->newDispatcher->dispatchTyped(new UserRemovedEvent($group, $this)); + $this->dispatcher->dispatchTyped(new UserRemovedEvent($group, $this)); } } // Delete the user's keys in preferences @@ -260,7 +260,7 @@ class User implements IUser { $accountManager = \OC::$server->query(AccountManager::class); $accountManager->deleteUser($this); - $this->dispatcher->dispatch(IUser::class . '::postDelete', new GenericEvent($this)); + $this->legacyDispatcher->dispatch(IUser::class . '::postDelete', new GenericEvent($this)); if ($this->emitter) { $this->emitter->emit('\OC\User', 'postDelete', [$this]); } @@ -276,7 +276,7 @@ class User implements IUser { * @return bool */ public function setPassword($password, $recoveryPassword = null) { - $this->dispatcher->dispatch(IUser::class . '::preSetPassword', new GenericEvent($this, [ + $this->legacyDispatcher->dispatch(IUser::class . '::preSetPassword', new GenericEvent($this, [ 'password' => $password, 'recoveryPassword' => $recoveryPassword, ])); @@ -285,7 +285,7 @@ class User implements IUser { } if ($this->backend->implementsActions(Backend::SET_PASSWORD)) { $result = $this->backend->setPassword($this->uid, $password); - $this->dispatcher->dispatch(IUser::class . '::postSetPassword', new GenericEvent($this, [ + $this->legacyDispatcher->dispatch(IUser::class . '::postSetPassword', new GenericEvent($this, [ 'password' => $password, 'recoveryPassword' => $recoveryPassword, ])); @@ -482,7 +482,7 @@ class User implements IUser { } public function triggerChange($feature, $value = null, $oldValue = null) { - $this->dispatcher->dispatch(IUser::class . '::changeUser', new GenericEvent($this, [ + $this->legacyDispatcher->dispatch(IUser::class . '::changeUser', new GenericEvent($this, [ 'feature' => $feature, 'value' => $value, 'oldValue' => $oldValue, -- 2.39.5