diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-10-29 07:17:22 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-10-29 07:17:22 +0000 |
commit | 46f988bcc5eca0542f4f6ccb8d900ae94f385da8 (patch) | |
tree | 0eb4cfbaa511c0665ed7f83e5f33c840e835b60f | |
parent | f05e3c2fcfd14d94b41ba7a49c858b694845cd8f (diff) | |
download | brdo-46f988bcc5eca0542f4f6ccb8d900ae94f385da8.tar.gz brdo-46f988bcc5eca0542f4f6ccb8d900ae94f385da8.tar.bz2 |
#615516 by Crell: Use slave servers for statistics module.
-rw-r--r-- | modules/statistics/statistics.admin.inc | 28 | ||||
-rw-r--r-- | modules/statistics/statistics.module | 2 | ||||
-rw-r--r-- | modules/statistics/statistics.pages.inc | 12 |
3 files changed, 21 insertions, 21 deletions
diff --git a/modules/statistics/statistics.admin.inc b/modules/statistics/statistics.admin.inc index d9367743f..9227e2787 100644 --- a/modules/statistics/statistics.admin.inc +++ b/modules/statistics/statistics.admin.inc @@ -17,7 +17,7 @@ function statistics_recent_hits() { array('data' => t('Operations')) ); - $query = db_select('accesslog', 'a')->extend('PagerDefault')->extend('TableSort'); + $query = db_select('accesslog', 'a', array('target' => 'slave'))->extend('PagerDefault')->extend('TableSort'); $query->join('users', 'u', 'a.uid = u.uid'); $query ->fields('a', array('aid', 'timestamp', 'path', 'title', 'uid')) @@ -40,8 +40,8 @@ function statistics_recent_hits() { } $build['statistics_table'] = array( - '#theme' => 'table', - '#header' => $header, + '#theme' => 'table', + '#header' => $header, '#rows' => $rows, ); $build['statistics_pager'] = array('#theme' => 'pager'); @@ -59,7 +59,7 @@ function statistics_top_pages() { array('data' => t('Total page generation time'), 'field' => 'total_time') ); - $query = db_select('accesslog')->extend('PagerDefault')->extend('TableSort'); + $query = db_select('accesslog', array('target' => 'slave'))->extend('PagerDefault')->extend('TableSort'); $query->addExpression('COUNT(path)', 'hits'); // MAX(title) avoids having empty node titles which otherwise causes duplicates in the top pages list $query->addExpression('MAX(title)', 'title'); @@ -72,7 +72,7 @@ function statistics_top_pages() { ->limit(30) ->orderByHeader($header); - $count_query = db_select('accesslog'); + $count_query = db_select('accesslog', array('target' => 'slave')); $count_query->addExpression('COUNT(DISTINCT path)'); $query->setCountQuery($count_query); @@ -88,8 +88,8 @@ function statistics_top_pages() { drupal_set_title(t('Top pages in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))), PASS_THROUGH); $build['statistics_top_pages_table'] = array( - '#theme' => 'table', - '#header' => $header, + '#theme' => 'table', + '#header' => $header, '#rows' => $rows, ); $build['statistics_top_pages_pager'] = array('#theme' => 'pager'); @@ -107,7 +107,7 @@ function statistics_top_visitors() { array('data' => t('Total page generation time'), 'field' => 'total'), array('data' => user_access('block IP addresses') ? t('Operations') : '', 'colspan' => 2), ); - $query = db_select('accesslog', 'a')->extend('PagerDefault')->extend('TableSort'); + $query = db_select('accesslog', 'a', array('target' => 'slave'))->extend('PagerDefault')->extend('TableSort'); $query->leftJoin('blocked_ips', 'bl', 'a.hostname = bl.ip'); $query->leftJoin('users', 'u', 'a.uid = u.uid'); @@ -142,8 +142,8 @@ function statistics_top_visitors() { drupal_set_title(t('Top visitors in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))), PASS_THROUGH); $build['statistics_top_visitors_table'] = array( - '#theme' => 'table', - '#header' => $header, + '#theme' => 'table', + '#header' => $header, '#rows' => $rows, ); $build['statistics_top_visitors_pager'] = array('#theme' => 'pager'); @@ -173,7 +173,7 @@ function statistics_top_referrers() { ->limit(30) ->orderByHeader($header); - $count_query = db_select('accesslog'); + $count_query = db_select('accesslog', array('target' => 'slave')); $count_query->addExpression('COUNT(DISTINCT url)'); $count_query ->where('LOWER(url) NOT LIKE :host', array(':host' => '%' . $_SERVER['HTTP_HOST'] . '%')) @@ -191,8 +191,8 @@ function statistics_top_referrers() { } $build['statistics_top_referrers_table'] = array( - '#theme' => 'table', - '#header' => $header, + '#theme' => 'table', + '#header' => $header, '#rows' => $rows, ); $build['statistics_top_referrers_pager'] = array('#theme' => 'pager'); @@ -233,7 +233,7 @@ function statistics_access_log($aid) { ); $build['statistics_table'] = array( - '#theme' => 'table', + '#theme' => 'table', '#rows' => $rows, ); return $build; diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index a8dd9ef38..611c650b7 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -289,7 +289,7 @@ function statistics_get($nid) { if ($nid > 0) { // Retrieve an array with both totalcount and daycount. - return db_query('SELECT totalcount, daycount, timestamp FROM {node_counter} WHERE nid = :nid', array(':nid' => $nid))->fetchAssoc(); + return db_query('SELECT totalcount, daycount, timestamp FROM {node_counter} WHERE nid = :nid', array(':nid' => $nid), array('target' => 'slave'))->fetchAssoc(); } } diff --git a/modules/statistics/statistics.pages.inc b/modules/statistics/statistics.pages.inc index b74b5d703..c676a4f81 100644 --- a/modules/statistics/statistics.pages.inc +++ b/modules/statistics/statistics.pages.inc @@ -15,7 +15,7 @@ function statistics_node_tracker() { array('data' => t('User'), 'field' => 'u.name'), array('data' => t('Operations'))); - $query = db_select('accesslog', 'a')->extend('PagerDefault')->extend('TableSort'); + $query = db_select('accesslog', 'a', array('target' => 'slave'))->extend('PagerDefault')->extend('TableSort'); $query->join('users', 'u', 'a.uid = u.uid'); $query @@ -44,8 +44,8 @@ function statistics_node_tracker() { drupal_set_title($node->title[FIELD_LANGUAGE_NONE][0]['value']); $build['statistics_table'] = array( - '#theme' => 'table', - '#header' => $header, + '#theme' => 'table', + '#header' => $header, '#rows' => $rows ); $build['statistics_pager'] = array('#theme' => 'pager'); @@ -63,7 +63,7 @@ function statistics_user_tracker() { array('data' => t('Timestamp'), 'field' => 'timestamp', 'sort' => 'desc'), array('data' => t('Page'), 'field' => 'path'), array('data' => t('Operations'))); - $query = db_select('accesslog', 'a')->extend('PagerDefault')->extend('TableSort'); + $query = db_select('accesslog', 'a', array('target' => 'slave'))->extend('PagerDefault')->extend('TableSort'); $query ->fields('a', array('aid', 'timestamp', 'path', 'title')) ->condition('uid', $account->uid) @@ -85,8 +85,8 @@ function statistics_user_tracker() { drupal_set_title($account->name); $build['statistics_table'] = array( - '#theme' => 'table', - '#header' => $header, + '#theme' => 'table', + '#header' => $header, '#rows' => $rows ); $build['statistics_pager'] = array('#theme' => 'pager'); |