You are here

function statistics_cron in Drupal 4

Same name and namespace in other branches
  1. 8 core/modules/statistics/statistics.module \statistics_cron()
  2. 5 modules/statistics/statistics.module \statistics_cron()
  3. 6 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.module, line 356
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 expired access logs */
  db_query('DELETE FROM {accesslog} WHERE timestamp < %d', time() - variable_get('statistics_flush_accesslog_timer', 259200));
}