You are here

function statistics_cron in Drupal 8

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

Implements hook_cron().

File

core/modules/statistics/statistics.module, line 73
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));
}