comparison core/modules/statistics/statistics.module @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents c75dbcec494b
children
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
22 $output .= '<h3>' . t('About') . '</h3>'; 22 $output .= '<h3>' . t('About') . '</h3>';
23 $output .= '<p>' . t('The Statistics module shows you how often content is viewed. This is useful in determining which pages of your site are most popular. For more information, see the <a href=":statistics_do">online documentation for the Statistics module</a>.', [':statistics_do' => 'https://www.drupal.org/documentation/modules/statistics/']) . '</p>'; 23 $output .= '<p>' . t('The Statistics module shows you how often content is viewed. This is useful in determining which pages of your site are most popular. For more information, see the <a href=":statistics_do">online documentation for the Statistics module</a>.', [':statistics_do' => 'https://www.drupal.org/documentation/modules/statistics/']) . '</p>';
24 $output .= '<h3>' . t('Uses') . '</h3>'; 24 $output .= '<h3>' . t('Uses') . '</h3>';
25 $output .= '<dl>'; 25 $output .= '<dl>';
26 $output .= '<dt>' . t('Displaying popular content') . '</dt>'; 26 $output .= '<dt>' . t('Displaying popular content') . '</dt>';
27 $output .= '<dd>' . t('The module includes a <em>Popular content</em> block that displays the most viewed pages today and for all time, and the last content viewed. To use the block, enable <em>Count content views</em> on the <a href=":statistics-settings">Statistics page</a>, and then you can enable and configure the block on the <a href=":blocks">Block layout page</a>.', [':statistics-settings' => \Drupal::url('statistics.settings'), ':blocks' => (\Drupal::moduleHandler()->moduleExists('block')) ? \Drupal::url('block.admin_display') : '#']) . '</dd>'; 27 $output .= '<dd>' . t('The module includes a <em>Popular content</em> block that displays the most viewed pages today and for all time, and the last content viewed. To use the block, enable <em>Count content views</em> on the <a href=":statistics-settings">Statistics page</a>, and then you can enable and configure the block on the <a href=":blocks">Block layout page</a>.', [':statistics-settings' => Url::fromRoute('statistics.settings')->toString(), ':blocks' => (\Drupal::moduleHandler()->moduleExists('block')) ? Url::fromRoute('block.admin_display')->toString() : '#']) . '</dd>';
28 $output .= '<dt>' . t('Page view counter') . '</dt>'; 28 $output .= '<dt>' . t('Page view counter') . '</dt>';
29 $output .= '<dd>' . t('The Statistics module includes a counter for each page that increases whenever the page is viewed. To use the counter, enable <em>Count content views</em> on the <a href=":statistics-settings">Statistics page</a>, and set the necessary <a href=":permissions">permissions</a> (<em>View content hits</em>) so that the counter is visible to the users.', [':statistics-settings' => \Drupal::url('statistics.settings'), ':permissions' => \Drupal::url('user.admin_permissions', [], ['fragment' => 'module-statistics'])]) . '</dd>'; 29 $output .= '<dd>' . t('The Statistics module includes a counter for each page that increases whenever the page is viewed. To use the counter, enable <em>Count content views</em> on the <a href=":statistics-settings">Statistics page</a>, and set the necessary <a href=":permissions">permissions</a> (<em>View content hits</em>) so that the counter is visible to the users.', [':statistics-settings' => Url::fromRoute('statistics.settings')->toString(), ':permissions' => Url::fromRoute('user.admin_permissions', [], ['fragment' => 'module-statistics'])->toString()]) . '</dd>';
30 $output .= '</dl>'; 30 $output .= '</dl>';
31 return $output; 31 return $output;
32 32
33 case 'statistics.settings': 33 case 'statistics.settings':
34 return '<p>' . t('Settings for the statistical information that Drupal will keep about the site.') . '</p>'; 34 return '<p>' . t('Settings for the statistical information that Drupal will keep about the site.') . '</p>';
90 * 90 *
91 * @return SelectQuery|false 91 * @return SelectQuery|false
92 * A query result containing the node ID, title, user ID that owns the node, 92 * A query result containing the node ID, title, user ID that owns the node,
93 * and the username for the selected node(s), or FALSE if the query could not 93 * and the username for the selected node(s), or FALSE if the query could not
94 * be executed correctly. 94 * be executed correctly.
95 *
96 * @deprecated in Drupal 8.6.0 and will be removed before Drupal 9.0.0.
97 * Use \Drupal\statistics\NodeStatisticsDatabaseStorage::fetchAll() instead.
95 */ 98 */
96 function statistics_title_list($dbfield, $dbrows) { 99 function statistics_title_list($dbfield, $dbrows) {
100 @trigger_error('statistics_title_list() is deprecated in Drupal 8.6.0 and will be removed before Drupal 9.0.0. Use \Drupal\statistics\NodeStatisticsDatabaseStorage::fetchAll() instead.', E_USER_DEPRECATED);
97 if (in_array($dbfield, ['totalcount', 'daycount', 'timestamp'])) { 101 if (in_array($dbfield, ['totalcount', 'daycount', 'timestamp'])) {
98 $query = db_select('node_field_data', 'n'); 102 $query = \Drupal::database()->select('node_field_data', 'n');
99 $query->addTag('node_access'); 103 $query->addTag('node_access');
100 $query->join('node_counter', 's', 'n.nid = s.nid'); 104 $query->join('node_counter', 's', 'n.nid = s.nid');
101 $query->join('users_field_data', 'u', 'n.uid = u.uid'); 105 $query->join('users_field_data', 'u', 'n.uid = u.uid');
102 106
103 return $query 107 return $query