function cleaner_cron in Cleaner 8
Same name and namespace in other branches
- 8.2 cleaner.module \cleaner_cron()
- 5 cleaner.module \cleaner_cron()
- 6 cleaner.module \cleaner_cron()
- 7 cleaner.module \cleaner_cron()
Implements hook_cron().
1 string reference to 'cleaner_cron'
- CleanerSettingsForm::buildForm in src/
Form/ CleanerSettingsForm.php - Form constructor.
File
- ./
cleaner.module, line 12 - Allows the admin to set a schedule for clearing caches and other stuff.
Code
function cleaner_cron() {
$config = \Drupal::config(CLEANER_SETTINGS);
$interval = (int) $config
->get('cleaner_cron');
$last = (int) $config
->get('cleaner_last_cron');
if (REQUEST_TIME >= $last + $interval) {
\Drupal::moduleHandler()
->invokeAll('cleaner_run');
}
\Drupal::configFactory()
->getEditable(CLEANER_SETTINGS)
->set('cleaner_last_cron', REQUEST_TIME)
->save();
}