WIP: schedulers..

This commit is contained in:
2025-10-08 15:53:45 +00:00
parent f440223a26
commit cf65b86547
11 changed files with 54 additions and 59 deletions

View File

@@ -68,7 +68,6 @@ $current_user->getSystemUser();
///////////////////////////////////////////////////////////////////////////////
//// PREP FOR SCHEDULER PID
$GLOBALS['log']->debug('--------------------------------------------> at cron.php <--------------------------------------------');
$cachePath = $GLOBALS['sugar_config']['cache_dir'].'modules/Schedulers';
$pid = 'pid.php';
@@ -79,14 +78,10 @@ if(!is_file($cachePath.'/'.$pid)) {
if(is_writable($cachePath)) { // the "file" does not yet exist
write_array_to_file('timestamp', array(strtotime(date('H:i'))) , $cachePath.'/'.$pid);
require_once($cachePath.'/'.$pid);
} else {
$GLOBALS['log']->fatal('Scheduler cannot write PID file. Please check permissions on '.$cachePath);
}
} else {
if(is_writable($cachePath.'/'.$pid)) {
require_once($cachePath.'/'.$pid);
} else {
$GLOBALS['log']->fatal('Scheduler cannot read the PID file. Please check permissions on '.$cachePath);
}
}
//// END PREP FOR SCHEDULER PID
@@ -102,11 +97,7 @@ if($timestamp[0] < strtotime(date('H:i'))) {
$s = new Scheduler();
$s->flushDeadJobs();
$s->checkPendingJobs();
} else {
$GLOBALS['log']->fatal('Scheduler cannot write PID file. Please check permissions on '.$cachePath);
}
} else {
$GLOBALS['log']->fatal('If you see a whole string of these, there is a chance someone is attacking your system.');
}
$exit_on_cleanup = true;
sugar_cleanup($exit_on_cleanup);