aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/AllConfig.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2024-09-13 09:16:35 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-09-13 11:41:53 +0000
commit25d70bf77fd98a1f1c55ca7e55872d2ca73617f6 (patch)
treee1956bd1e47bcca8c101e7b242371913e11998f0 /lib/private/AllConfig.php
parent264cd2dccec00c0ebaaff57f341ae37cb9eb8b58 (diff)
downloadnextcloud-server-25d70bf77fd98a1f1c55ca7e55872d2ca73617f6.tar.gz
nextcloud-server-25d70bf77fd98a1f1c55ca7e55872d2ca73617f6.zip
fix(config): Throw PreconditionException always when it didn't matchbackport/47933/stable28
Previously even when the precondition did not match, the call "passed" when the after value was the expected one. This however can lead to race conditions, duplicate code excutions and other things. Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/AllConfig.php')
-rw-r--r--lib/private/AllConfig.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php
index 7a54de2b7bb..558b181050d 100644
--- a/lib/private/AllConfig.php
+++ b/lib/private/AllConfig.php
@@ -264,10 +264,10 @@ class AllConfig implements IConfig {
$prevValue = $this->getUserValue($userId, $appName, $key, null);
if ($prevValue !== null) {
- if ($prevValue === (string)$value) {
- return;
- } elseif ($preCondition !== null && $prevValue !== (string)$preCondition) {
+ if ($preCondition !== null && $prevValue !== (string)$preCondition) {
throw new PreConditionNotMetException();
+ } elseif ($prevValue === (string)$value) {
+ return;
} else {
$qb = $this->connection->getQueryBuilder();
$qb->update('preferences')