diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-01-26 20:58:39 +0100 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-05-12 21:02:52 +0200 |
commit | eef973e85ba5e5cc322079ff85a599d42f1334e6 (patch) | |
tree | 23d99edd8f57e07973ae1327a67bab3c47f6b1c1 /apps/dav/lib/HookManager.php | |
parent | eb45a6ca404524bad6416ba3b3a755f9faa5e9b8 (diff) | |
download | nextcloud-server-eef973e85ba5e5cc322079ff85a599d42f1334e6.tar.gz nextcloud-server-eef973e85ba5e5cc322079ff85a599d42f1334e6.zip |
Minor optimizations for saving user personal information
* Remove double hook: the OC_User::changeUser triggers an
OC\AccountManager::userUpdated and the app is already listening to this
signal in its Application definition
* Make createCard not check if an card exists if we already checked
previously. We also don't try to get the card if the user is disabled
as we don't use the card in this case
We this change we go from 100 DB requests to 80 DB requests when saving
an user email address.
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
(cherry picked from commit c6fd482edf33214a9ad4787e4cac278f871fa7c8)
Diffstat (limited to 'apps/dav/lib/HookManager.php')
-rw-r--r-- | apps/dav/lib/HookManager.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/dav/lib/HookManager.php b/apps/dav/lib/HookManager.php index f0fdd5cfd4f..b69d9b0cd79 100644 --- a/apps/dav/lib/HookManager.php +++ b/apps/dav/lib/HookManager.php @@ -105,10 +105,7 @@ class HookManager { $this->postDeleteUser(['uid' => $uid]); }); \OC::$server->getUserManager()->listen('\OC\User', 'postUnassignedUserId', [$this, 'postUnassignedUserId']); - Util::connectHook('OC_User', - 'changeUser', - $this, - 'changeUser'); + Util::connectHook('OC_User', 'changeUser', $this, 'changeUser'); } public function postCreateUser($params) { @@ -164,7 +161,12 @@ class HookManager { public function changeUser($params) { $user = $params['user']; - $this->syncService->updateUser($user); + $feature = $params['feature']; + // This case is already covered by the account manager firing up a signal + // later on + if ($feature !== 'eMailAddress' && $feature !== 'displayName') { + $this->syncService->updateUser($user); + } } public function firstLogin(IUser $user = null) { |