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.
This commit is contained in:
parent
2f64684299
commit
4716627453
15
boot.php
15
boot.php
@ -2346,21 +2346,27 @@ function cert_bad_email() {
|
|||||||
*/
|
*/
|
||||||
function check_cron_broken() {
|
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) {
|
if(! $t) {
|
||||||
// never checked before. Start the timer.
|
// never checked before. Start the timer.
|
||||||
set_config('system','lastpollcheck',datetime_convert());
|
set_config('system','lastcroncheck',datetime_convert());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($t > datetime_convert('UTC','UTC','now - 3 days')) {
|
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
|
// Wait for 3 days before we do anything so as not to swamp the admin with messages
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$d = get_config('system','lastpoll');
|
|
||||||
if(($d) && ($d > datetime_convert('UTC','UTC','now - 3 days'))) {
|
if(($d) && ($d > datetime_convert('UTC','UTC','now - 3 days'))) {
|
||||||
// Scheduled tasks have run successfully in the last 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2377,7 +2383,6 @@ function check_cron_broken() {
|
|||||||
'From: Administrator' . '@' . App::get_hostname() . "\n"
|
'From: Administrator' . '@' . App::get_hostname() . "\n"
|
||||||
. 'Content-type: text/plain; charset=UTF-8' . "\n"
|
. 'Content-type: text/plain; charset=UTF-8' . "\n"
|
||||||
. 'Content-transfer-encoding: 8bit' );
|
. 'Content-transfer-encoding: 8bit' );
|
||||||
set_config('system','lastpollcheck',datetime_convert());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user