]> git.wh0rd.org - tt-rss.git/blobdiff - utils/xml-export.php
unify update_daemon, update_feeds and update_feedbrowser into update.php; move update...
[tt-rss.git] / utils / xml-export.php
index 620331fba3a9128edd1e9b60d0ff565c57681e31..6926fd6c2f17bef379cebd800d6eaef73e42de71 100644 (file)
@@ -1,7 +1,7 @@
 <?
-       session_start();
+       require_once "sessions.php";
 
-       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
@@ -93,7 +97,7 @@
                                updated,
                                guid,
                                link,
-                               SUBSTRING(date_entered,1,16) AS date_entered,
+                               SUBSTRING(date_updated,1,16) AS date_updated,
                                SUBSTRING(last_read,1,16) AS last_read, 
                                comments,
                                ttrss_feeds.feed_url AS feed_url,
                                updated,
                                guid,
                                link,
-                               SUBSTRING(date_entered,1,16) AS date_entered,
+                               SUBSTRING(date_updated,1,16) AS date_updated,
                                SUBSTRING(last_read,1,16) AS last_read, 
                                comments,
                                ttrss_feeds.feed_url AS feed_url,