You are here

public function NodeStatisticsDatabaseStorage::maxTotalCount in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/statistics/src/NodeStatisticsDatabaseStorage.php \Drupal\statistics\NodeStatisticsDatabaseStorage::maxTotalCount()

Returns the highest 'totalcount' value.

Return value

int The highest 'totalcount' value.

Overrides StatisticsStorageInterface::maxTotalCount

File

core/modules/statistics/src/NodeStatisticsDatabaseStorage.php, line 131

Class

NodeStatisticsDatabaseStorage
Provides the default database storage backend for statistics.

Namespace

Drupal\statistics

Code

public function maxTotalCount() {
  $query = $this->connection
    ->select('node_counter', 'nc');
  $query
    ->addExpression('MAX(totalcount)');
  $max_total_count = (int) $query
    ->execute()
    ->fetchField();
  return $max_total_count;
}