You are here

function statistics_cron in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/statistics/statistics.module \statistics_cron()
  2. 4 modules/statistics.module \statistics_cron()
  3. 5 modules/statistics/statistics.module \statistics_cron()
  4. 6 modules/statistics/statistics.module \statistics_cron()
  5. 7 modules/statistics/statistics.module \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() {
  $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));
}