statistics_cron()
Implements hook_cron().
File
- core/modules/statistics/statistics.module, line 72
- Logs and displays content statistics for a site.
Code
function statistics_cron() { $statistics_timestamp = \Drupal::state()->get('statistics.day_timestamp') ? : 0; if ((REQUEST_TIME - $statistics_timestamp) >= 86400) { // Reset day counts. db_update('node_counter') ->fields(array('daycount' => 0)) ->execute(); \Drupal::state()->set('statistics.day_timestamp', REQUEST_TIME); } // Calculate the maximum of node views, for node search ranking. \Drupal::state()->set('statistics.node_counter_scale', 1.0 / max(1.0, db_query('SELECT MAX(totalcount) FROM {node_counter}')->fetchField())); }
Please login to continue.