You are here

function statistics_cron in Drupal 6

Same name and namespace in other branches
  1. 8 core/modules/statistics/statistics.module \statistics_cron()
  2. 4 modules/statistics.module \statistics_cron()
  3. 5 modules/statistics/statistics.module \statistics_cron()
  4. 7 modules/statistics/statistics.module \statistics_cron()
  5. 9 core/modules/statistics/statistics.module \statistics_cron()

Implementation of hook_cron().

File

modules/statistics/statistics.module, line 178
Logs access statistics for your site.

Code

function statistics_cron() {
  $statistics_timestamp = variable_get('statistics_day_timestamp', '');
  if (time() - $statistics_timestamp >= 86400) {

    // Reset day counts.
    db_query('UPDATE {node_counter} SET daycount = 0');
    variable_set('statistics_day_timestamp', time());
  }

  // Clean up expired access logs.
  if (variable_get('statistics_flush_accesslog_timer', 259200) > 0) {
    db_query('DELETE FROM {accesslog} WHERE timestamp < %d', time() - variable_get('statistics_flush_accesslog_timer', 259200));
  }
}