function system_update_8013

Enable automated cron module and move the config into it.

File

core/modules/system/system.install, line 2149

Code

function system_update_8013() {
  $autorun = \Drupal::configFactory()->getEditable('system.cron')
    ->get('threshold.autorun');
  if ($autorun) {
    // Install 'automated_cron' module.
    \Drupal::service('module_installer')->install([
      'automated_cron',
    ], FALSE);
    // Copy 'autorun' value into the new module's 'interval' setting.
    \Drupal::configFactory()->getEditable('automated_cron.settings')
      ->set('interval', $autorun)
      ->save(TRUE);
  }
  // Remove the 'autorun' key in system module config.
  \Drupal::configFactory()->getEditable('system.cron')
    ->clear('threshold.autorun')
    ->save(TRUE);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.