]> git.wh0rd.org Git - tt-rss.git/commitdiff
add auth to xml-export if required, bump schema compatibility constants
authorAndrew Dolgov <fox@bah.spb.su>
Sun, 12 Feb 2006 10:20:22 +0000 (11:20 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sun, 12 Feb 2006 10:20:22 +0000 (11:20 +0100)
utils/xml-export.php
utils/xml-import.php

index 620331fba3a9128edd1e9b60d0ff565c57681e31..a10c9e3dea6de9631432b09f4b5acbb63d9aeb7a 100644 (file)
@@ -1,7 +1,7 @@
 <?
        session_start();
 
-       define('MAX_SCHEMA_VERSION', 4);
+       define('MAX_SCHEMA_VERSION', 5);
 
        require_once "config.php";
        require_once "functions.php";
        if ($_GET["export"]) {
                header("Content-Type: application/xml");
        }
+
+       $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); 
+
+       if (!$link) {
+               if (DB_TYPE == "mysql") {
+                       print mysql_error();
+               }
+               // PG seems to display its own errors just fine by default.             
+               return;
+       }
+
+       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 > 1) login_sequence($link);
+
 ?>
 
 <? if (!$_GET["export"]) { ?>
 <xmldb>
 
 <?
-       $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); 
-
-       if (!$link) {
-               if (DB_TYPE == "mysql") {
-                       print mysql_error();
-               }
-               // PG seems to display its own errors just fine by default.             
-               return;
-       }
-
-       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>Source database schema is invalid
index 6cae60e0d21ef12d6fd6a53013dc0162e8470888..aeccd77e42425f592db85486268eb7185e45be18 100644 (file)
@@ -5,8 +5,8 @@
        require_once "functions.php";
        require_once "db.php";
 
-       define('MAX_SOURCE_SCHEMA_VERSION', 4);
-       define('TARGET_SCHEMA_VERSION', 4);
+       define('MAX_SOURCE_SCHEMA_VERSION', 5);
+       define('TARGET_SCHEMA_VERSION', 5);
 
        $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);