diff --git a/core/modules/statistics/src/StatisticsDatabaseStorage.php b/core/modules/statistics/src/StatisticsDatabaseStorage.php index b97b89f..2585a88 100644 --- a/core/modules/statistics/src/StatisticsDatabaseStorage.php +++ b/core/modules/statistics/src/StatisticsDatabaseStorage.php @@ -20,7 +20,7 @@ class StatisticsDatabaseStorage implements StatisticsStorageInterface { * @var \Drupal\Core\State\StateInterface */ protected $state; - + /** * Construct the statistics storage. * @@ -99,21 +99,8 @@ public function maxTotalCount() { } /** - * Returns the most viewed content of all time, today, or the last-viewed node. - * - * @param string $dbfield - * The database field to use, one of: - * - 'totalcount': Integer that shows the top viewed content of all time. - * - 'daycount': Integer that shows the top viewed content for today. - * - 'timestamp': Integer that shows only the last viewed node. - * @param int $dbrows - * The number of rows to be returned. - * - * @return SelectQuery|FALSE - * A query result containing the node ID, title, user ID that owns the node, - * and the username for the selected node(s), or FALSE if the query could not - * be executed correctly. - */ + * {@inheritdoc} + */ public function statisticsTitleList($dbfield, $dbrows) { if (in_array($dbfield, array('totalcount', 'daycount', 'timestamp'))) { $query = $this->connection->select('node_field_data', 'n'); diff --git a/core/modules/statistics/src/StatisticsStorageInterface.php b/core/modules/statistics/src/StatisticsStorageInterface.php index e5243e9..7e875c9 100644 --- a/core/modules/statistics/src/StatisticsStorageInterface.php +++ b/core/modules/statistics/src/StatisticsStorageInterface.php @@ -76,4 +76,25 @@ public function resetDayCount(); */ public function maxTotalCount(); + /** + * Returns the most viewed content of all time, today, or the last-viewed node. + * Used primarily in StatisticsPopularBlock and passed to node_title_list. + * + * @todo Offer more helpers for generating the database result object to node_title_list. + * + * @param string $dbfield + * The database field to use, one of: + * - 'totalcount': Integer that shows the top viewed content of all time. + * - 'daycount': Integer that shows the top viewed content for today. + * - 'timestamp': Integer that shows only the last viewed node. + * @param int $dbrows + * The number of rows to be returned. + * + * @return SelectQuery|FALSE + * A query result containing the node ID, title, user ID that owns the node, + * and the username for the selected node(s), or FALSE if the query could not + * be executed correctly. + */ + public function statisticsTitleList($dbfield, $dbrows); + } diff --git a/core/modules/statistics/statistics.module b/core/modules/statistics/statistics.module index 5e969d4..4d845ea 100644 --- a/core/modules/statistics/statistics.module +++ b/core/modules/statistics/statistics.module @@ -79,7 +79,7 @@ function statistics_cron() { /** * Returns the most viewed content of all time, today, or the last-viewed node. * - * @deprecated in Drupal 8.0.x + * @deprecated in Drupal 8.0.x, use statisticsTitleList in statistics_storage service. */ function statistics_title_list($dbfield, $dbrows) { return \Drupal::service('statistics.statistics_storage')->statisticsTitleList($dbfield, $dbrows); @@ -88,7 +88,7 @@ function statistics_title_list($dbfield, $dbrows) { /** * Retrieves a node's "view statistics". * - * @deprecated in Drupal 8.0.x + * @deprecated in Drupal 8.0.x, use fetchViews in statistics_storage service. */ function statistics_get($nid) { if ($nid > 0) {