- } */
-
- 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);
+ }
+
+ ksort($update_versions, SORT_NUMERIC);
+
+ $latest_version = max(array_keys($update_versions));
+
+ if ($version == $latest_version) {
+ print "<p>Tiny Tiny RSS database is up to date (version $version).</p>";
+ print "<p><a href='tt-rss.php'>Return to Tiny Tiny RSS</a></p>";
+ return;
+ }
+
+ 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);
+ }