From: Andrew Dolgov Date: Wed, 17 Apr 2013 08:10:35 +0000 (+0400) Subject: add schema checking to feed updating and update script X-Git-Tag: 1.7.9~25^2~177 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=857efe49e653787f5408fc014ae71efec68494d5;p=tt-rss.git add schema checking to feed updating and update script --- diff --git a/include/rssfuncs.php b/include/rssfuncs.php index 0a20f5d8..9ea2662f 100644 --- a/include/rssfuncs.php +++ b/include/rssfuncs.php @@ -60,6 +60,12 @@ function update_daemon_common($link, $limit = DAEMON_FEED_LIMIT, $from_http = false, $debug = true) { // Process all other feeds using last_updated and interval parameters + $schema_version = get_schema_version($link); + + if ($schema_version != SCHEMA_VERSION) { + die("Schema version is wrong, please upgrade the database.\n"); + } + define('PREFS_NO_CACHE', true); // Test if the user has loggued in recently. If not, it does not update its feeds. diff --git a/update.php b/update.php index f5fa9e56..1c43cdb9 100755 --- a/update.php +++ b/update.php @@ -89,6 +89,14 @@ return; } + if (!isset($options['update-schema'])) { + $schema_version = get_schema_version($link); + + if ($schema_version != SCHEMA_VERSION) { + die("Schema version is wrong, please upgrade the database.\n"); + } + } + define('QUIET', isset($options['quiet'])); if (isset($options["log"])) { diff --git a/update_daemon2.php b/update_daemon2.php index 8e1917b6..77d05be6 100755 --- a/update_daemon2.php +++ b/update_daemon2.php @@ -183,6 +183,10 @@ db_close($link); + if ($schema_version != SCHEMA_VERSION) { + die("Schema version is wrong, please upgrade the database.\n"); + } + while (true) { // Since sleep is interupted by SIGCHLD, we need another way to