Browse Source

Merge pull request #2147 from nextcloud/dont-update-same-value

Don't update value if it is already set to the same value
pull/1602/head
Roeland Jago Douma 10 years ago
committed by GitHub
parent
commit
50929751b0
  1. 10
      lib/private/AllConfig.php

10
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')

Loading…
Cancel
Save