You are here

function search_log_cron in Search Log 7

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

Implements hook_cron().

Expire outdated entries.

2 string references to 'search_log_cron'
search_log_admin_settings in ./search_log.admin.inc
Display admin settings.
search_log_admin_settings_validate in ./search_log.admin.inc
Validate admin settings.

File

./search_log.module, line 79
Replaces default report of top search phrases.

Code

function search_log_cron() {
  if ($days = (int) variable_get('search_log_cron', 0)) {

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