aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-05-13 12:56:39 +0200
committerGitHub <noreply@github.com>2022-05-13 12:56:39 +0200
commit9fcf53115433471ddcef6b28bf460642b7f6c8a3 (patch)
tree0ae43becb41d3e0af108b34cbaf7261966eca134 /lib
parentfe33e9c08cbbc80738660d2d78838f04d24e0e2e (diff)
parente71db404923f8c8b53e7968f8a10d3e7de0abe2a (diff)
downloadnextcloud-server-9fcf53115433471ddcef6b28bf460642b7f6c8a3.tar.gz
nextcloud-server-9fcf53115433471ddcef6b28bf460642b7f6c8a3.zip
Merge pull request #30863 from nextcloud/performance/saving-user-profile-info
Minor optimizations for saving user personal information
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Accounts/AccountManager.php18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php
index 5792ba1dc5d..7f79ab46c37 100644
--- a/lib/private/Accounts/AccountManager.php
+++ b/lib/private/Accounts/AccountManager.php
@@ -269,12 +269,15 @@ class AccountManager implements IAccountManager {
}
}
- protected function updateUser(IUser $user, array $data, bool $throwOnData = false): array {
- $oldUserData = $this->getUser($user, false);
+ protected function updateUser(IUser $user, array $data, ?array $oldUserData, bool $throwOnData = false): array {
+ if ($oldUserData === null) {
+ $oldUserData = $this->getUser($user, false);
+ }
+
$updated = true;
if ($oldUserData !== $data) {
- $this->updateExistingUser($user, $data);
+ $this->updateExistingUser($user, $data, $oldUserData);
} else {
// nothing needs to be done if new and old data set are the same
$updated = false;
@@ -601,12 +604,9 @@ class AccountManager implements IAccountManager {
}
/**
- * update existing user in accounts table
- *
- * @param IUser $user
- * @param array $data
+ * Update existing user in accounts table
*/
- protected function updateExistingUser(IUser $user, array $data): void {
+ protected function updateExistingUser(IUser $user, array $data, array $oldData): void {
$uid = $user->getUID();
$jsonEncodedData = $this->prepareJson($data);
$query = $this->connection->getQueryBuilder();
@@ -820,7 +820,7 @@ class AccountManager implements IAccountManager {
];
}
- $this->updateUser($account->getUser(), $data, true);
+ $this->updateUser($account->getUser(), $data, $oldData, true);
$this->internalCache->set($account->getUser()->getUID(), $account);
}
}