class CronFrequency in Automatic Updates 8
Cron frequency checker.
Hierarchy
- class \Drupal\automatic_updates\ReadinessChecker\CronFrequency implements ReadinessCheckerInterface uses StringTranslationTrait
Expanded class hierarchy of CronFrequency
1 string reference to 'CronFrequency'
1 service uses CronFrequency
File
- src/
ReadinessChecker/ CronFrequency.php, line 13
Namespace
Drupal\automatic_updates\ReadinessCheckerView source
class CronFrequency implements ReadinessCheckerInterface {
use StringTranslationTrait;
/**
* Minimum cron threshold is 3 hours.
*/
const MINIMUM_CRON_INTERVAL = 10800;
/**
* The config factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* The module handler.
*
* @var \Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/**
* CronFrequency constructor.
*
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The state service.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler.
*/
public function __construct(ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler) {
$this->configFactory = $config_factory;
$this->moduleHandler = $module_handler;
}
/**
* {@inheritdoc}
*/
public function run() {
$messages = [];
if ($this->moduleHandler
->moduleExists('automated_cron') && $this->configFactory
->get('automated_cron.settings')
->get('interval') > $this::MINIMUM_CRON_INTERVAL) {
$messages[] = $this
->t('Cron is not set to run frequently enough. <a href="@configure">Configure it</a> to run at least every 3 hours or disable automated cron and run it via an external scheduling system.', [
'@configure' => Url::fromRoute('system.cron_settings')
->toString(),
]);
}
return $messages;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CronFrequency:: |
protected | property | The config factory. | |
CronFrequency:: |
protected | property | The module handler. | |
CronFrequency:: |
constant | Minimum cron threshold is 3 hours. | ||
CronFrequency:: |
public | function |
Run check. Overrides ReadinessCheckerInterface:: |
|
CronFrequency:: |
public | function | CronFrequency constructor. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |