PoormansCron.php in Production check & Production monitor 8
File
src/Plugin/ProdCheck/Settings/PoormansCron.php
View source
<?php
namespace Drupal\prod_check\Plugin\ProdCheck\Settings;
use Drupal\prod_check\Plugin\ProdCheck\ProdCheckBase;
class PoormansCron extends ProdCheckBase {
protected $cronInterval;
public function init() {
$this->cronInterval = $this->configFactory
->get('system.cron')
->get('threshold.autorun');
}
public function state() {
return $this->cronInterval === NULL;
}
public function successMessages() {
return [
'value' => $this
->t("Drupal's built in cron mechanism is disabled."),
'description' => $this
->generateDescription($this
->title(), 'system.cron_settings'),
];
}
public function failMessages() {
return [
'value' => $this
->t("Drupal's built in cron mechanism is set to run every %interval.", [
'%interval' => $this->dateFormatter
->formatInterval($this->cronInterval),
]),
'description' => $this
->generateDescription($this
->title(), 'system.cron_settings', 'The %link interval should be disabled if you have also setup a crontab or scheduled task for this to avoid running the cron more often than you have planned to!'),
];
}
}