summaryrefslogtreecommitdiff
path: root/backend.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2005-11-10 05:35:39 +0100
committerAndrew Dolgov <[email protected]>2005-11-10 05:35:39 +0100
commit7ec2a838ef97834a93685dfea0e3f6cb4f38ac92 (patch)
tree0cd1086a4e94d7edca7a48622666af0f597b2ae7 /backend.php
parent5f171894d1dccc352c7ba6c48618aef8454b9134 (diff)
schema_version handling in backend.php
Diffstat (limited to 'backend.php')
-rw-r--r--backend.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/backend.php b/backend.php
index 611b67b38..2a8657474 100644
--- a/backend.php
+++ b/backend.php
@@ -1,4 +1,6 @@
<?
+ define(SCHEMA_VERSION, 2);
+
$op = $_GET["op"];
if ($op == "rpc") {
@@ -25,6 +27,16 @@
if (DB_TYPE == "pgsql") {
pg_query("set client_encoding = 'utf-8'");
}
+
+ $result = db_query($link, "SELECT schema_version FROM ttrss_version");
+
+ $schema_version = db_fetch_result($result, 0, "schema_version");
+
+ if ($schema_version != SCHEMA_VERSION) {
+ print "Error: database schema is invalid
+ (got version $schema_version; expected ".SCHEMA_VERSION.")";
+ return;
+ }
$fetch = $_GET["fetch"];