function statistics_cron

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

Implements hook_cron().

File

core/modules/statistics/statistics.module, line 74

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));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.