You are here

class CronOverride in Automatic Updates 8

This class overrides the default system warning and error limits for cron.

It notifies site administrators on a more strict time frame if cron has not recently run.

Hierarchy

Expanded class hierarchy of CronOverride

2 string references to 'CronOverride'
automatic_updates.services.yml in ./automatic_updates.services.yml
automatic_updates.services.yml
CronOverride::getCacheSuffix in src/EventSubscriber/CronOverride.php
The string to append to the configuration static cache name.
1 service uses CronOverride
automatic_updates.cron_override in ./automatic_updates.services.yml
Drupal\automatic_updates\EventSubscriber\CronOverride

File

src/EventSubscriber/CronOverride.php, line 15

Namespace

Drupal\automatic_updates\EventSubscriber
View source
class CronOverride implements ConfigFactoryOverrideInterface {

  /**
   * Warn at 3 hours.
   */
  const WARNING_THRESHOLD = 10800;

  /**
   * Error at 6 hours.
   */
  const ERROR_THRESHOLD = 21600;

  /**
   * {@inheritdoc}
   */
  public function loadOverrides($names) {
    $overrides = [];
    if (in_array('system.cron', $names, TRUE)) {
      $overrides['system.cron']['threshold'] = [
        'requirements_warning' => $this::WARNING_THRESHOLD,
        'requirements_error' => $this::ERROR_THRESHOLD,
      ];
    }
    return $overrides;
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheSuffix() {
    return 'CronOverride';
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheableMetadata($name) {
    return new CacheableMetadata();
  }

  /**
   * {@inheritdoc}
   */
  public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION) {
    return NULL;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CronOverride::createConfigObject public function Creates a configuration object for use during install and synchronization. Overrides ConfigFactoryOverrideInterface::createConfigObject
CronOverride::ERROR_THRESHOLD constant Error at 6 hours.
CronOverride::getCacheableMetadata public function Gets the cacheability metadata associated with the config factory override. Overrides ConfigFactoryOverrideInterface::getCacheableMetadata
CronOverride::getCacheSuffix public function The string to append to the configuration static cache name. Overrides ConfigFactoryOverrideInterface::getCacheSuffix
CronOverride::loadOverrides public function Returns config overrides. Overrides ConfigFactoryOverrideInterface::loadOverrides
CronOverride::WARNING_THRESHOLD constant Warn at 3 hours.