cleaner.module in Cleaner 8.2
Same filename and directory in other branches
Basic module file.
File
cleaner.moduleView source
<?php
/**
* @file
* Basic module file.
*/
use Drupal\cleaner\Event\CleanerRunEvent;
/**
* Implements hook_cron().
*/
function cleaner_cron() {
$config = \Drupal::configFactory()
->getEditable('cleaner.settings');
$request_time = (int) \Drupal::time()
->getRequestTime();
$interval = (int) $config
->get('cleaner_cron');
$last = (int) $config
->get('cleaner_last_cron');
if ($request_time >= $last + $interval) {
// Dispatch the CleanerRunEvent.
\Drupal::service('event_dispatcher')
->dispatch(CleanerRunEvent::CLEANER_RUN, new CleanerRunEvent());
}
$config
->set('cleaner_last_cron', $request_time)
->save();
}
Functions
Name | Description |
---|---|
cleaner_cron | Implements hook_cron(). |