X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=update_daemon2.php;h=6d13add0051135c4e65858184ba7ecfc13a11926;hb=404e2e3603c852a3f82a21c14b8888005e2b3f99;hp=37d6b40747adfc298c2dea96ab9162a7cc450d5b;hpb=f0e015c428e9bdbcab5e0b3313baca694146477a;p=tt-rss.git diff --git a/update_daemon2.php b/update_daemon2.php index 37d6b407..6d13add0 100755 --- a/update_daemon2.php +++ b/update_daemon2.php @@ -14,12 +14,14 @@ define('DAEMON_EXTENDED_DEBUG', true); } + require_once "autoload.php"; require_once "functions.php"; require_once "rssfuncs.php"; require_once "sanity_check.php"; require_once "config.php"; require_once "db.php"; require_once "db-prefs.php"; + require_once "errorhandler.php"; // defaults define('PURGE_INTERVAL', 3600); // seconds @@ -176,12 +178,16 @@ // It is unnecessary to start the fork loop if database is not ok. $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); - if (!init_connection($link)) die("Can't initialize db connection.\n"); + if (!init_plugins($link)) die("Can't initialize db connection.\n"); $schema_version = get_schema_version($link); 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 @@ -198,7 +204,7 @@ /* Check if schema version changed */ $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); - if (!init_connection($link)) die("Can't initialize db connection.\n"); + if (!init_plugins($link)) die("Can't initialize db connection.\n"); $test_schema_version = get_schema_version($link); db_close($link); @@ -250,7 +256,7 @@ $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); - if (!init_connection($link)) return; + if (!init_plugins($link)) return; // We disable stamp file, since it is of no use in a multiprocess update. // not really, tho for the time being -fox @@ -284,7 +290,11 @@ _debug("Elapsed time: " . (time() - $start_timestamp) . " second(s)"); if ($nf > 0) { - _debug("Feeds processed: $nf; feeds/minute: " . sprintf("%.2d", $nf/((time()-$start_timestamp)/60))); + _debug("Feeds processed: $nf"); + + if (time() - $start_timestamp > 0) { + _debug("Feeds/minute: " . sprintf("%.2d", $nf/((time()-$start_timestamp)/60))); + } } db_close($link);