statistics_cron

Definition

statistics_cron()
modules/statistics/statistics.module, line 178

Description

Implementation of hook_cron().

Code

<?php
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.
  db_query('DELETE FROM {accesslog} WHERE timestamp < %d', time() - variable_get('statistics_flush_accesslog_timer', 259200));
}
?>
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.