summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2016-11-16 19:54:25 +0100
committerGitHub <noreply@github.com>2016-11-16 19:54:25 +0100
commit50929751b05e9ff09ecad7dde733178f7120e77c (patch)
treeca10f887249ce78c1713d63ca78fac3e238ec282
parent4035d60847af55166118fd4810dc0e8ae38de86a (diff)
parent577a8a730f79bf3605f5826fbd1affe16747e3f7 (diff)
downloadnextcloud-server-50929751b05e9ff09ecad7dde733178f7120e77c.tar.gz
nextcloud-server-50929751b05e9ff09ecad7dde733178f7120e77c.zip
Merge pull request #2147 from nextcloud/dont-update-same-value
Don't update value if it is already set to the same value
-rw-r--r--lib/private/AllConfig.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php
index af26d30d8e9..4e13d70371b 100644
--- a/lib/private/AllConfig.php
+++ b/lib/private/AllConfig.php
@@ -215,11 +215,13 @@ class AllConfig implements \OCP\IConfig {
// TODO - FIXME
$this->fixDIInit();
- if (isset($this->userCache[$userId][$appName][$key])) {
- if ($this->userCache[$userId][$appName][$key] === (string)$value) {
- return;
- } else if ($preCondition !== null && $this->userCache[$userId][$appName][$key] !== (string)$preCondition) {
+ $prevValue = $this->getUserValue($userId, $appName, $key, null);
+
+ if ($prevValue !== null) {
+ if ($prevValue === (string)$value) {
return;
+ } else if ($preCondition !== null && $prevValue !== (string)$preCondition) {
+ throw new PreConditionNotMetException();
} else {
$qb = $this->connection->getQueryBuilder();
$qb->update('preferences')