summaryrefslogtreecommitdiffstats
path: root/lib/private/preferences.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/preferences.php')
-rw-r--r--lib/private/preferences.php11
1 files changed, 8 insertions, 3 deletions
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) {