From b4c27af79aa9924b31959153622032d3c83ddc82 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 24 Feb 2007 18:16:33 +0100 Subject: misc updater tweaks --- update.php | 189 +++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 102 insertions(+), 87 deletions(-) (limited to 'update.php') diff --git a/update.php b/update.php index 964626d7f..5b91bde32 100644 --- a/update.php +++ b/update.php @@ -1,139 +1,154 @@ - Database Updater - - +Database Updater + + + +

Database Updater

Tiny Tiny RSS database is up to date (version $version).

"; + print "

Return to Tiny Tiny RSS

"; + return; +} - if (!$op) { - print "

Warning: Please backup your database before proceeding.

"; +if (!$op) { + print "

Warning: Please backup your database before proceeding.

"; - print "

Your database schema version is $version. Latest version is ". - "$latest_version.

"; + print "

Your Tiny Tiny RSS database needs update to the latest + version ($version —> $latest_version).

"; - print "

Available incremental updates:"; +/* print "

Available incremental updates:"; - foreach (array_keys($update_versions) as $v) { - if ($v > $version) { - print " $v"; - } + foreach (array_keys($update_versions) as $v) { + if ($v > $version) { + print " $v"; } + } */ + + print "

"; - print "

"; - print "Click here to perform updates."; + print "
+ + +
"; - } else if ($op == "do") { +} else if ($op == "do") { - print "

Performing updates (version: $version)...

"; + print "

Performing updates (from version $version)...

"; - $num_updates = 0; + $num_updates = 0; - foreach (array_keys($update_versions) as $v) { - if ($v == $version + 1) { - print "

Updating to version $v...

"; - $fp = fopen($update_versions[$v], "r"); - if ($fp) { - while (!feof($fp)) { - $query = trim(getline($fp, ";")); - if ($query != "") { - print "

QUERY: $query

"; - db_query($link, $query); - } + foreach (array_keys($update_versions) as $v) { + if ($v == $version + 1) { + print "

Updating to version $v...

"; + $fp = fopen($update_versions[$v], "r"); + if ($fp) { + while (!feof($fp)) { + $query = trim(getline($fp, ";")); + if ($query != "") { + print "

QUERY: $query

"; + db_query($link, $query); } } - fclose($fp); - - print "

Checking version... "; + } + fclose($fp); - $result = db_query($link, "SELECT schema_version FROM ttrss_version"); - $version = db_fetch_result($result, 0, "schema_version"); + print "

Checking version... "; - if ($version == $v) { - print "OK!"; - } else { - print "ERROR!"; - return; - } + $result = db_query($link, "SELECT schema_version FROM ttrss_version"); + $version = db_fetch_result($result, 0, "schema_version"); - $num_updates++; + if ($version == $v) { + print "OK! ($version)"; + } else { + print "ERROR!"; + return; } - } - print "

Finished. Performed $num_updates updates up to schema - version $version.

"; + $num_updates++; + } } + + print "

Finished. Performed $num_updates updates up to schema + version $version.

"; + + print "

Return to Tiny Tiny RSS

"; + +} + ?> -- cgit v1.2.3