function system_update_8013 in Drupal 8
Enable automated cron module and move the config into it.
File
- core/
modules/ system/ system.install, line 2149 - Install, update and uninstall functions for the system module.
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);
}