]> git.wh0rd.org Git - tt-rss.git/commitdiff
get_schema_version: add nocache parameter
authorAndrew Dolgov <fox@bah.org.ru>
Wed, 13 Jan 2010 19:03:42 +0000 (22:03 +0300)
committerAndrew Dolgov <fox@bah.org.ru>
Wed, 13 Jan 2010 19:03:42 +0000 (22:03 +0300)
functions.php

index 507595e77c629bb358efb55a1489bd64c02902ff..3d09e0f6913e1dc59c4d5d203db3400fed6d05ef 100644 (file)
                        return "even";
        }
 
-       function get_schema_version($link) {
-               $result = db_query($link, "SELECT schema_version FROM ttrss_version");
-               return (int) db_fetch_result($result, 0, "schema_version");
+       function get_schema_version($link, $nocache = false) {
+               if (!$_SESSION["schema_version"] || $nocache) {
+                       $result = db_query($link, "SELECT schema_version FROM ttrss_version");
+                       $version = db_fetch_result($result, 0, "schema_version");
+                       $_SESSION["schema_version"] = $version;
+                       return $version;
+               } else {
+                       return $_SESSION["schema_version"];
+               }
        }
 
        function sanity_check($link) {