You are here

function visitors_cron in Visitors 8.2

Same name and namespace in other branches
  1. 8 visitors.module \visitors_cron()
  2. 7.2 visitors.module \visitors_cron()
  3. 7 visitors.module \visitors_cron()
  4. 7.0 visitors.module \visitors_cron()

Implements of hook_cron().

File

./visitors.module, line 44
Logs visitors for your site.

Code

function visitors_cron() {
  $flush_log_timer = \Drupal::config('visitors.config')
    ->get('flush_log_timer', 0);
  if ($flush_log_timer > 0) {

    // Clean up expired access logs.
    \Drupal::database()
      ->delete('visitors')
      ->condition('visitors_date_time', time() - $flush_log_timer, '<')
      ->execute();
  }
}