X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=update.php;h=f59f9ef3e56c04397c6a2d7de718df1d7305f353;hb=f46192bb191acdbc733f60bad60c4eb83ebb2e26;hp=4f7a097c02e67c421050887dc28c4ba8fcfacdd2;hpb=06719138737a450eba676864a004e6f4959b39c5;p=tt-rss.git diff --git a/update.php b/update.php index 4f7a097c..f59f9ef3 100644 --- a/update.php +++ b/update.php @@ -13,19 +13,23 @@ 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"]; - if ($_SESSION["access_level"] < 10) { - print "

". - __("Error: your access level is insufficient to run this script.")."

"; + if (!SINGLE_USER_MODE && $_SESSION["access_level"] < 10) { + $_SESSION["login_error_msg"] = __("Your access level is insufficient to run this script."); + render_login_form($link); exit; } - - define('SCHEMA_VERSION', 14); + ?> @@ -83,18 +87,28 @@ function confirmOP() { ksort($update_versions, SORT_NUMERIC); $latest_version = max(array_keys($update_versions)); - + if ($version == $latest_version) { - print "

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

"; - print "
- -
"; + + if ($version != SCHEMA_VERSION) { + print_error(__("Could not update database")); + + print "

" . + __("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_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) . "

";