summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-25 21:42:05 +0300
committerAndrew Dolgov <[email protected]>2021-02-25 21:42:05 +0300
commita1ca62af50047a92692c009b97bebb73f94db7ea (patch)
tree47f884324f34fef0d293add0be4a33a7a22feb1d /include
parent22ae284db48d03a2a9c52d48add35ce329450a99 (diff)
cache schema version better
Diffstat (limited to 'include')
-rw-r--r--include/functions.php10
-rw-r--r--include/sessions.php17
2 files changed, 2 insertions, 25 deletions
diff --git a/include/functions.php b/include/functions.php
index 746f8d39e..6d845035e 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -166,8 +166,6 @@
define('SELF_USER_AGENT', 'Tiny Tiny RSS/' . get_version() . ' (http://tt-rss.org/)');
ini_set('user_agent', SELF_USER_AGENT);
- $schema_version = false;
-
/* compat shims */
function _debug($msg) {
@@ -306,13 +304,7 @@
}
function get_schema_version() {
- $pdo = Db::pdo();
-
- $row = $pdo->query("SELECT schema_version FROM ttrss_version")->fetch();
- $version = $row["schema_version"];
- $schema_version = $version;
-
- return $version;
+ return Config::get_schema_version();
}
function file_is_locked($filename) {
diff --git a/include/sessions.php b/include/sessions.php
index 23815e182..891a6b3fa 100644
--- a/include/sessions.php
+++ b/include/sessions.php
@@ -19,25 +19,10 @@
ini_set("session.gc_maxlifetime", $session_expire);
ini_set("session.cookie_lifetime", "0");
- function session_get_schema_version() {
- global $schema_version;
-
- if (!$schema_version) {
- $row = \Db::pdo()->query("SELECT schema_version FROM ttrss_version")->fetch();
-
- $version = $row["schema_version"];
-
- $schema_version = $version;
- return $version;
- } else {
- return $schema_version;
- }
- }
-
function validate_session() {
if (\Config::get(\Config::SINGLE_USER_MODE)) return true;
- if (isset($_SESSION["ref_schema_version"]) && $_SESSION["ref_schema_version"] != session_get_schema_version()) {
+ if (isset($_SESSION["ref_schema_version"]) && $_SESSION["ref_schema_version"] != \Config::get_schema_version()) {
$_SESSION["login_error_msg"] =
__("Session failed to validate (schema version changed)");
return false;