function recently_read_cron in Recently Read 8
Implements hook_cron().
File
- ./
recently_read.module, line 45 - The module will track user activities on the website.
Code
function recently_read_cron() {
$config = Drupal::configFactory()
->getEditable('recently_read.configuration');
$recentlyRead = \Drupal::service('recently_read');
switch ($config
->get('delete_config')) {
case "time":
$time = $config
->get('delete_time');
$query = \Drupal::entityQuery('recently_read')
->condition('created', strtotime($time), '<=');
$records = $query
->execute();
if ($records) {
$recentlyRead
->deleteRecords($records);
}
break;
}
}