]> git.wh0rd.org Git - tt-rss.git/commitdiff
daemon: periodically create stampfile
authorAndrew Dolgov <fox@bah.spb.su>
Mon, 16 Jul 2007 12:22:13 +0000 (13:22 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Mon, 16 Jul 2007 12:22:13 +0000 (13:22 +0100)
functions.php
update_daemon.php

index b00c6b0dd3fea1ee53854fbb007aac012484d04d..fff1b91514df9afba24f05b38d0616c08d0f498e 100644 (file)
                }
        }
 
+       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()";
index 528418fb377e01b3184ee54171699082d96f7962..b7a5116883538eaa8481f2fc052b92f7f8e09010 100644 (file)
 
        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);