summaryrefslogtreecommitdiff
path: root/classes/prefs.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-25 14:38:29 +0300
committerAndrew Dolgov <[email protected]>2021-02-25 14:38:29 +0300
commit011e3189474fea78270db00bccab10e21c7ef023 (patch)
tree82d10fc515b9541bd8db0e9cadf249ba167d4bdb /classes/prefs.php
parent6f02b1afd0d99afc736a7c39aad37d6fd02c3cae (diff)
prefs: don't try to do anything on schema < 141
Diffstat (limited to 'classes/prefs.php')
-rw-r--r--classes/prefs.php20
1 files changed, 13 insertions, 7 deletions
diff --git a/classes/prefs.php b/classes/prefs.php
index d2f2cb4fb..ef925a3e9 100644
--- a/classes/prefs.php
+++ b/classes/prefs.php
@@ -203,15 +203,17 @@ class Prefs {
}
}
- // fill in any overrides from the database
- $sth = $this->pdo->prepare("SELECT pref_name, value FROM ttrss_user_prefs2
- WHERE owner_uid = :uid AND
- (profile = :profile OR (:profile IS NULL AND profile IS NULL))");
+ if (get_schema_version(true) >= 141) {
+ // fill in any overrides from the database
+ $sth = $this->pdo->prepare("SELECT pref_name, value FROM ttrss_user_prefs2
+ WHERE owner_uid = :uid AND
+ (profile = :profile OR (:profile IS NULL AND profile IS NULL))");
- $sth->execute(["uid" => $owner_uid, "profile" => $profile_id]);
+ $sth->execute(["uid" => $owner_uid, "profile" => $profile_id]);
- while ($row = $sth->fetch()) {
- $this->_set_cache($row["pref_name"], $row["value"], $owner_uid, $profile_id);
+ while ($row = $sth->fetch()) {
+ $this->_set_cache($row["pref_name"], $row["value"], $owner_uid, $profile_id);
+ }
}
}
@@ -225,6 +227,10 @@ class Prefs {
list ($def_val, $type_hint) = self::_DEFAULTS[$pref_name];
+ if (get_schema_version(true) < 141) {
+ return Config::cast_to($def_val, $type_hint);
+ }
+
$cached_value = $this->_get_cache($pref_name, $owner_uid, $profile_id);
if (!empty($cached_value)) {