From: Andrew Dolgov Date: Mon, 16 Jul 2007 12:22:13 +0000 (+0100) Subject: daemon: periodically create stampfile X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=bf7fcde8d56640e63994df528fd59631a4f58946;p=tt-rss.git daemon: periodically create stampfile --- diff --git a/functions.php b/functions.php index b00c6b0d..fff1b915 100644 --- a/functions.php +++ b/functions.php @@ -1505,6 +1505,19 @@ } } + function make_stampfile($filename) { + $fp = fopen($filename, "w"); + + if ($fp) { + fwrite($fp, time() . "\n"); + fclose($fp); + return true; + } else { + return false; + } + } + + function sql_random_function() { if (DB_TYPE == "mysql") { return "RAND()"; diff --git a/update_daemon.php b/update_daemon.php index 528418fb..b7a51168 100644 --- a/update_daemon.php +++ b/update_daemon.php @@ -71,6 +71,11 @@ while (true) { + if (!make_stampfile('update_daemon.stamp')) { + print "error: unable to create stampfile"; + die; + } + if (time() - $last_purge > PURGE_INTERVAL) { _debug("Purging old posts (random 30 feeds)..."); global_purge_old_posts($link, true, 30);