]> git.wh0rd.org - tt-rss.git/blobdiff - update.php
update_daemon2: make proper lockfile
[tt-rss.git] / update.php
index e3a25f47cf68504dbb53f140d0418fbef9a8ad82..f59f9ef3e56c04397c6a2d7de718df1d7305f353 100644 (file)
        if (DB_TYPE == "pgsql") {
                pg_query($link, "set client_encoding = 'utf-8'");
                pg_set_client_encoding("UNICODE");
+       } else {
+               if (defined('MYSQL_CHARSET') && MYSQL_CHARSET) {
+                       db_query($link, "SET NAMES " . MYSQL_CHARSET);
+//                     db_query($link, "SET CHARACTER SET " . MYSQL_CHARSET);
+               }
        }
-       
+
        login_sequence($link);
        
        $owner_uid = $_SESSION["uid"];
@@ -82,18 +87,28 @@ function confirmOP() {
        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.")."</p>";
-               print "<form method=\"GET\" action=\"tt-rss.php\">
-                       <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
-                       </form>";
+
+               if ($version != SCHEMA_VERSION) {
+                       print_error(__("Could not update database"));
+
+                       print "<p>" . 
+                               __("Could not find necessary schema file, need version:") .
+                               " " . SCHEMA_VERSION . __(", found: ") . $latest_version . "</p>";
+
+               } else {
+                       print "<p>".__("Tiny Tiny RSS database is up to date.")."</p>";
+                       print "<form method=\"GET\" action=\"tt-rss.php\">
+                               <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
+                               </form>";
+               }
 
                return;
        }
        
        if (!$op) {
-               print_warning("Please backup your database before proceeding.");
+               print_warning(__("Please backup your database before proceeding."));
        
                print "<p>" . T_sprintf("Your Tiny Tiny RSS database needs update to the latest version (<b>%d</b> to <b>%d</b>).", $version, $latest_version) . "</p>";