summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2006-02-12 11:20:22 +0100
committerAndrew Dolgov <[email protected]>2006-02-12 11:20:22 +0100
commitcce5b59a751d5a6189ee4e988efe25e06fa589c6 (patch)
tree7a3ce5b6fcaf859ba329b72dfd2b627ca6e621f6 /utils
parent3f286c4c2bb531156e16f3a1f809d36811ca1cd4 (diff)
add auth to xml-export if required, bump schema compatibility constants
Diffstat (limited to 'utils')
-rw-r--r--utils/xml-export.php40
-rw-r--r--utils/xml-import.php4
2 files changed, 24 insertions, 20 deletions
diff --git a/utils/xml-export.php b/utils/xml-export.php
index 620331fba..a10c9e3de 100644
--- a/utils/xml-export.php
+++ b/utils/xml-export.php
@@ -1,7 +1,7 @@
<?
session_start();
- define('MAX_SCHEMA_VERSION', 4);
+ define('MAX_SCHEMA_VERSION', 5);
require_once "config.php";
require_once "functions.php";
@@ -10,6 +10,27 @@
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"]) { ?>
@@ -39,23 +60,6 @@
<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
diff --git a/utils/xml-import.php b/utils/xml-import.php
index 6cae60e0d..aeccd77e4 100644
--- a/utils/xml-import.php
+++ b/utils/xml-import.php
@@ -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);