From 661135c742cc31bc0eece3bb669dad707d0aff66 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 9 Nov 2010 16:33:08 +0300 Subject: unify update_daemon, update_feeds and update_feedbrowser into update.php; move update.php to db-updater.php --- db-updater.php | 171 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 db-updater.php (limited to 'db-updater.php') diff --git a/db-updater.php b/db-updater.php new file mode 100644 index 000000000..76e308856 --- /dev/null +++ b/db-updater.php @@ -0,0 +1,171 @@ + + + + +Database Updater + + + + + + + + + + +

+ +" . + __("Could not find necessary schema file, need version:") . + " " . SCHEMA_VERSION . __(", found: ") . $latest_version . "

"; + + } else { + print "

".__("Tiny Tiny RSS database is up to date.")."

"; + print "
+ +
"; + } + + return; + } + + if (!$op) { + print_warning(__("Please backup your database before proceeding.")); + + print "

" . T_sprintf("Your Tiny Tiny RSS database needs update to the latest version (%d to %d).", $version, $latest_version) . "

"; + + /* print "

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

"; + + print "
+ + +
"; + + } else if ($op == "do") { + + print "

".__("Performing updates...")."

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

".T_sprintf("Updating to version %d...", $v)."

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

$query

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

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

".T_sprintf("Finished. Performed %d update(s) up to schema + version %d.", $num_updates, $version)."

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