aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-05-25 21:10:13 -0700
committerredmatrix <git@macgirvin.com>2016-05-25 21:10:13 -0700
commit4716627453c811bd6be6bf72afd83f43ab1abfc0 (patch)
treec07f155b5b593f36a668fc432b2f422538be228d
parent2f64684299784126bb3bc80fbe9978ec57d19a4c (diff)
downloadvolse-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-xboot.php15
1 files changed, 10 insertions, 5 deletions
diff --git a/boot.php b/boot.php
index d4836e61c..2fa7d8061 100755
--- a/boot.php
+++ b/boot.php
@@ -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;
}