diff options
author | redmatrix <git@macgirvin.com> | 2016-05-25 21:10:13 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-05-25 21:10:13 -0700 |
commit | 4716627453c811bd6be6bf72afd83f43ab1abfc0 (patch) | |
tree | c07f155b5b593f36a668fc432b2f422538be228d | |
parent | 2f64684299784126bb3bc80fbe9978ec57d19a4c (diff) | |
download | volse-hubzilla-4716627453c811bd6be6bf72afd83f43ab1abfc0.tar.gz volse-hubzilla-4716627453c811bd6be6bf72afd83f43ab1abfc0.tar.bz2 volse-hubzilla-4716627453c811bd6be6bf72afd83f43ab1abfc0.zip |
run background/daemon tasks at approximately 4 hour intervals from web accesses if they aren't being run otherwise. This ensures they run, although perhaps a bit infrequently; even if unconfigured. This is not suitable for a production site, but may be acceptable for small single person hubs and test sites. The 'cron warning email' now means that background processes are totally borked; probably due to a fascist hosting provider that has blocked process execution.
-rwxr-xr-x | boot.php | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -2346,21 +2346,27 @@ function cert_bad_email() { */ function check_cron_broken() { - $t = get_config('system','lastpollcheck'); + $d = get_config('system','lastcron'); + + if((! $d) || ($d < datetime_convert('UTC','UTC','now - 4 hours'))) { + Zotlabs\Daemon\Master::Summon(array('Cron')); + } + + $t = get_config('system','lastcroncheck'); if(! $t) { // never checked before. Start the timer. - set_config('system','lastpollcheck',datetime_convert()); + set_config('system','lastcroncheck',datetime_convert()); return; } + if($t > datetime_convert('UTC','UTC','now - 3 days')) { // Wait for 3 days before we do anything so as not to swamp the admin with messages return; } - $d = get_config('system','lastpoll'); if(($d) && ($d > datetime_convert('UTC','UTC','now - 3 days'))) { // Scheduled tasks have run successfully in the last 3 days. - set_config('system','lastpollcheck',datetime_convert()); + set_config('system','lastcroncheck',datetime_convert()); return; } @@ -2377,7 +2383,6 @@ function check_cron_broken() { 'From: Administrator' . '@' . App::get_hostname() . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" . 'Content-transfer-encoding: 8bit' ); - set_config('system','lastpollcheck',datetime_convert()); return; } |