daemon: periodically create stampfile

master
Andrew Dolgov 18 years ago
parent af6f8bf241
commit bf7fcde8d5

@ -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() { function sql_random_function() {
if (DB_TYPE == "mysql") { if (DB_TYPE == "mysql") {
return "RAND()"; return "RAND()";

@ -71,6 +71,11 @@
while (true) { while (true) {
if (!make_stampfile('update_daemon.stamp')) {
print "error: unable to create stampfile";
die;
}
if (time() - $last_purge > PURGE_INTERVAL) { if (time() - $last_purge > PURGE_INTERVAL) {
_debug("Purging old posts (random 30 feeds)..."); _debug("Purging old posts (random 30 feeds)...");
global_purge_old_posts($link, true, 30); global_purge_old_posts($link, true, 30);

Loading…
Cancel
Save