mirror of
https://github.com/espocrm/espocrm.git
synced 2026-07-01 08:26:04 +00:00
Fixed checking if crontab is configured
This commit is contained in:
@@ -46,11 +46,11 @@ class ScheduledJob
|
||||
protected $allowedMethod = 'run';
|
||||
|
||||
/**
|
||||
* Last cron run time to check if crontab is configured properly
|
||||
* Period to check if crontab is configured properly
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $lastCronRunTime = '24 hours';
|
||||
protected $checkingCronPeriod = '25 hours';
|
||||
|
||||
/**
|
||||
* @var array - path to cron job files
|
||||
@@ -208,8 +208,8 @@ class ScheduledJob
|
||||
*/
|
||||
public function isCronConfigured()
|
||||
{
|
||||
$nowDate = new \DateTime('now', new \DateTimeZone("UTC"));
|
||||
$startDate = new \DateTime('-' . $this->lastCronRunTime, new \DateTimeZone("UTC"));
|
||||
$startDate = new \DateTime('-' . $this->checkingCronPeriod, new \DateTimeZone("UTC"));
|
||||
$endDate = new \DateTime('+' . $this->checkingCronPeriod, new \DateTimeZone("UTC"));
|
||||
|
||||
$query = "
|
||||
SELECT job.id FROM scheduled_job
|
||||
@@ -217,8 +217,8 @@ class ScheduledJob
|
||||
WHERE
|
||||
scheduled_job.job = 'Dummy'
|
||||
AND scheduled_job.deleted = 0
|
||||
AND job.execute_time BETWEEN '". $startDate->format('Y-m-d H:i:s') ."' AND '". $nowDate->format('Y-m-d H:i:s') ."'
|
||||
AND (job.status IN ('Success', 'Failed') OR (job.status = 'Pending' AND job.execute_time >= '". $nowDate->modify('-1 hour')->format('Y-m-d H:i:s') ."') )
|
||||
AND job.execute_time BETWEEN '". $startDate->format('Y-m-d H:i:s') ."' AND '". $endDate->format('Y-m-d H:i:s') ."'
|
||||
AND job.status IN ('Success', 'Failed', 'Pending')
|
||||
ORDER BY job.execute_time DESC
|
||||
";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user