You are here

function search_log_cron in Search Log 6

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

Implementation of 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 133
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 = mktime(0, 0, 0) - $days * 86400;
    db_query("DELETE FROM {search_log} WHERE day < %d", $day);
  }
  cache_clear_all(NULL, SEARCH_LOG_BLOCK_CACHE_TABLE);
}