-
- if (!$op) {
- print "<p class='warning'><b>Warning:</b> Please backup your database before proceeding.</p>";
-
- print "<p>Your Tiny Tiny RSS database needs update to the latest
- version ($version —> $latest_version).</p>";
-
- /* print "<p>Available incremental updates:";
-
- foreach (array_keys($update_versions) as $v) {
- if ($v > $version) {
- print " <a href='$update_versions[$v]'>$v</a>";
- }
- } */
-
- print "</p>";
-
- print "<form method='POST'>
- <input type='hidden' name='op' value='do'>
- <input type='submit' onclick='return confirmOP()' value='Perform updates'>
- </form>";
-
- } else if ($op == "do") {
-
- print "<p>Performing updates (from version $version)...</p>";
-
- $num_updates = 0;
-
- foreach (array_keys($update_versions) as $v) {
- if ($v == $version + 1) {
- print "<p>Updating to version $v...</p>";
- $fp = fopen($update_versions[$v], "r");
- if ($fp) {
- while (!feof($fp)) {
- $query = trim(getline($fp, ";"));
- if ($query != "") {
- print "<p class='query'><b>QUERY:</b> $query</p>";
- db_query($link, $query);
- }
- }
- }
- fclose($fp);
-
- print "<p>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! ($version)";
- } else {
- print "<b>ERROR!</b>";
- return;
- }
-
- $num_updates++;
- }
- }
-
- print "<p>Finished. Performed $num_updates updates up to schema
- version $version.</p>";
-
- print "<form method=\"GET\" action=\"tt-rss.php\">
- <input type=\"submit\" value=\"Return to Tiny Tiny RSS\">
- </form>";