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

Implements hook_cron().

File

core/modules/statistics/statistics.module, line 74
Logs and displays content statistics for a site.

Code

function statistics_cron() {
  $storage = \Drupal::service('statistics.storage.node');
  $storage
    ->resetDayCount();
  $max_total_count = $storage
    ->maxTotalCount();
  \Drupal::state()
    ->set('statistics.node_counter_scale', 1.0 / max(1.0, $max_total_count));
}