diff options
author | Joas Schilling <coding@schilljs.com> | 2024-09-13 09:16:35 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2024-09-13 11:41:01 +0000 |
commit | bc750a1d09daa8e0db7a1b61794c2ff7df19a279 (patch) | |
tree | 8c1e61377c1b61f89a289dc30887ec7100de401d /lib | |
parent | 4e50fbb482e850f29bf6d7da8e326504b3b20611 (diff) | |
download | nextcloud-server-bc750a1d09daa8e0db7a1b61794c2ff7df19a279.tar.gz nextcloud-server-bc750a1d09daa8e0db7a1b61794c2ff7df19a279.zip |
fix(config): Throw PreconditionException always when it didn't matchbackport/47933/stable29
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')
-rw-r--r-- | lib/private/AllConfig.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php index de1c19c953a..f0169fee18d 100644 --- a/lib/private/AllConfig.php +++ b/lib/private/AllConfig.php @@ -269,10 +269,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') |