Skip to content
Snippets Groups Projects
Commit e43ea3f9 authored by Steven Wittens's avatar Steven Wittens
Browse files

#36936 / #36937: PgSQL fixes for statistics

parent 21bed11e
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -247,7 +247,7 @@ function statistics_recent_hits($type = 'all', $id = 0) { ...@@ -247,7 +247,7 @@ function statistics_recent_hits($type = 'all', $id = 0) {
* Menu callback; presents the "top pages" page. * Menu callback; presents the "top pages" page.
*/ */
function statistics_top_pages() { function statistics_top_pages() {
$sql = "SELECT COUNT(path) AS hits, path, title, AVG(timer) AS average_time, SUM(timer) AS total_time FROM {accesslog} GROUP BY path"; $sql = "SELECT COUNT(path) AS hits, path, title, AVG(timer) AS average_time, SUM(timer) AS total_time FROM {accesslog} GROUP BY path, title";
$sql_cnt = "SELECT COUNT(DISTINCT(path)) FROM {accesslog}"; $sql_cnt = "SELECT COUNT(DISTINCT(path)) FROM {accesslog}";
$header = array( $header = array(
...@@ -281,7 +281,7 @@ function statistics_top_visitors() { ...@@ -281,7 +281,7 @@ function statistics_top_visitors() {
array('data' => t('Operations')) array('data' => t('Operations'))
); );
$sql = "SELECT COUNT(a.uid) AS hits, a.uid, u.name, a.hostname, SUM(a.timer) AS total, ac.aid FROM {accesslog} a LEFT JOIN {access} ac ON ac.type = 'host' AND LOWER(a.hostname) LIKE (ac.mask) LEFT JOIN {users} u ON a.uid = u.uid GROUP BY a.hostname". tablesort_sql($header); $sql = "SELECT COUNT(a.uid) AS hits, a.uid, u.name, a.hostname, SUM(a.timer) AS total, ac.aid FROM {accesslog} a LEFT JOIN {access} ac ON ac.type = 'host' AND LOWER(a.hostname) LIKE (ac.mask) LEFT JOIN {users} u ON a.uid = u.uid GROUP BY a.hostname, a.uid, u.name, ac.aid". tablesort_sql($header);
$sql_cnt = "SELECT COUNT(DISTINCT(uid)) FROM {accesslog}"; $sql_cnt = "SELECT COUNT(DISTINCT(uid)) FROM {accesslog}";
$result = pager_query($sql, 30, 0, $sql_cnt); $result = pager_query($sql, 30, 0, $sql_cnt);
......
...@@ -247,7 +247,7 @@ function statistics_recent_hits($type = 'all', $id = 0) { ...@@ -247,7 +247,7 @@ function statistics_recent_hits($type = 'all', $id = 0) {
* Menu callback; presents the "top pages" page. * Menu callback; presents the "top pages" page.
*/ */
function statistics_top_pages() { function statistics_top_pages() {
$sql = "SELECT COUNT(path) AS hits, path, title, AVG(timer) AS average_time, SUM(timer) AS total_time FROM {accesslog} GROUP BY path"; $sql = "SELECT COUNT(path) AS hits, path, title, AVG(timer) AS average_time, SUM(timer) AS total_time FROM {accesslog} GROUP BY path, title";
$sql_cnt = "SELECT COUNT(DISTINCT(path)) FROM {accesslog}"; $sql_cnt = "SELECT COUNT(DISTINCT(path)) FROM {accesslog}";
$header = array( $header = array(
...@@ -281,7 +281,7 @@ function statistics_top_visitors() { ...@@ -281,7 +281,7 @@ function statistics_top_visitors() {
array('data' => t('Operations')) array('data' => t('Operations'))
); );
$sql = "SELECT COUNT(a.uid) AS hits, a.uid, u.name, a.hostname, SUM(a.timer) AS total, ac.aid FROM {accesslog} a LEFT JOIN {access} ac ON ac.type = 'host' AND LOWER(a.hostname) LIKE (ac.mask) LEFT JOIN {users} u ON a.uid = u.uid GROUP BY a.hostname". tablesort_sql($header); $sql = "SELECT COUNT(a.uid) AS hits, a.uid, u.name, a.hostname, SUM(a.timer) AS total, ac.aid FROM {accesslog} a LEFT JOIN {access} ac ON ac.type = 'host' AND LOWER(a.hostname) LIKE (ac.mask) LEFT JOIN {users} u ON a.uid = u.uid GROUP BY a.hostname, a.uid, u.name, ac.aid". tablesort_sql($header);
$sql_cnt = "SELECT COUNT(DISTINCT(uid)) FROM {accesslog}"; $sql_cnt = "SELECT COUNT(DISTINCT(uid)) FROM {accesslog}";
$result = pager_query($sql, 30, 0, $sql_cnt); $result = pager_query($sql, 30, 0, $sql_cnt);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment