You are here

function search_log_cron in Search Log 8

Same name and namespace in other branches
  1. 6 search_log.module \search_log_cron()
  2. 7 search_log.module \search_log_cron()

Implements hook_cron().

Expire outdated entries.

1 string reference to 'search_log_cron'
SearchLogConfigurationForm::buildForm in src/Form/SearchLogConfigurationForm.php
.

File

./search_log.module, line 29
This module holds functions of Search Log Module.

Code

function search_log_cron() {
  if ($days = (int) \Drupal::config('search_log.settings')
    ->get('search_log_cron')) {

    // Get timestamp for 12:00 today UTC minus days.
    $day = _search_log_get_time() - $days * 86400;
    \Drupal::database()
      ->delete('search_log')
      ->condition('day', $day, '<')
      ->execute();
  }
}