prefs: don't try to do anything on schema < 141

This commit is contained in:
Andrew Dolgov 2021-02-25 14:38:29 +03:00
parent 6f02b1afd0
commit 011e318947
1 changed files with 13 additions and 7 deletions

View File

@ -203,6 +203,7 @@ class Prefs {
}
}
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
@ -214,6 +215,7 @@ class Prefs {
$this->_set_cache($row["pref_name"], $row["value"], $owner_uid, $profile_id);
}
}
}
static function get(string $pref_name, int $owner_uid, int $profile_id = null) {
return self::get_instance()->_get($pref_name, $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)) {