function statistics_cron
Same name in other branches
- 9 core/modules/statistics/statistics.module \statistics_cron()
- 8.9.x core/modules/statistics/statistics.module \statistics_cron()
- 10 core/modules/statistics/statistics.module \statistics_cron()
- 11.x core/modules/statistics/statistics.module \statistics_cron()
Implements hook_cron().
File
-
modules/
statistics/ statistics.module, line 245
Code
function statistics_cron() {
$statistics_timestamp = variable_get('statistics_day_timestamp', 0);
if (REQUEST_TIME - $statistics_timestamp >= 86400) {
// Reset day counts.
db_update('node_counter')->fields(array(
'daycount' => 0,
))
->execute();
variable_set('statistics_day_timestamp', REQUEST_TIME);
}
// Clean up expired access logs (if applicable).
if (variable_get('statistics_flush_accesslog_timer', 259200) > 0) {
db_delete('accesslog')->condition('timestamp', REQUEST_TIME - variable_get('statistics_flush_accesslog_timer', 259200), '<')
->execute();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.