diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/appconfig.php | 4 | ||||
-rw-r--r-- | lib/private/preferences.php | 11 |
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/private/appconfig.php b/lib/private/appconfig.php index f20c4a08426..1874d9f2b19 100644 --- a/lib/private/appconfig.php +++ b/lib/private/appconfig.php @@ -183,6 +183,10 @@ class AppConfig implements \OCP\IAppConfig { ); $this->conn->insert('*PREFIX*appconfig', $data); } else { + $oldValue = $this->getValue($app, $key); + if($oldValue === strval($value)) { + return true; + } $data = array( 'configvalue' => $value, ); diff --git a/lib/private/preferences.php b/lib/private/preferences.php index d1db25bbf09..a849cc23e1a 100644 --- a/lib/private/preferences.php +++ b/lib/private/preferences.php @@ -173,11 +173,16 @@ class Preferences { */ public function setValue($user, $app, $key, $value, $preCondition = null) { // Check if the key does exist - $query = 'SELECT COUNT(*) FROM `*PREFIX*preferences`' + $query = 'SELECT `configvalue` FROM `*PREFIX*preferences`' . ' WHERE `userid` = ? AND `appid` = ? AND `configkey` = ?'; - $count = $this->conn->fetchColumn($query, array($user, $app, $key)); - $exists = $count > 0; + $oldValue = $this->conn->fetchColumn($query, array($user, $app, $key)); + $exists = $oldValue !== false; + if($oldValue === strval($value)) { + // no changes + return true; + } + $affectedRows = 0; if (!$exists && $preCondition === null) { |