aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_admin.php
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2011-05-08 03:12:16 -0400
committerOleg Pudeyev <oleg@bsdpower.com>2011-05-08 03:12:16 -0400
commite345c35bc413397a40f2aac3048cc4d2500420aa (patch)
tree373f7d29b1eb7ddc228ee838f929e1fa9f2ccf78 /phpBB/includes/functions_admin.php
parentfe347ec1124de7022bbbf37d0a1fffeff56c7271 (diff)
parent441755bf170e49799e311c71b2123ff263970d62 (diff)
downloadforums-e345c35bc413397a40f2aac3048cc4d2500420aa.tar
forums-e345c35bc413397a40f2aac3048cc4d2500420aa.tar.gz
forums-e345c35bc413397a40f2aac3048cc4d2500420aa.tar.bz2
forums-e345c35bc413397a40f2aac3048cc4d2500420aa.tar.xz
forums-e345c35bc413397a40f2aac3048cc4d2500420aa.zip
Merge commit '441755bf170e49799e311c71b2123ff263970d62' into feature/prune-users
* commit '441755bf170e49799e311c71b2123ff263970d62': [ticket/9874] view_log() performs unneeded count query over all log entries.
Diffstat (limited to 'phpBB/includes/functions_admin.php')
-rw-r--r--phpBB/includes/functions_admin.php24
1 files changed, 14 insertions, 10 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 9ef782e848..1468345003 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -2506,6 +2506,7 @@ function cache_moderators()
/**
* View log
+* If $log_count is set to false, we will skip counting all entries in the database.
*/
function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $limit_days = 0, $sort_by = 'l.log_time DESC', $keywords = '')
{
@@ -2761,16 +2762,19 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
}
}
- $sql = 'SELECT COUNT(l.log_id) AS total_entries
- FROM ' . LOG_TABLE . ' l, ' . USERS_TABLE . " u
- WHERE l.log_type = $log_type
- AND l.user_id = u.user_id
- AND l.log_time >= $limit_days
- $sql_keywords
- $sql_forum";
- $result = $db->sql_query($sql);
- $log_count = (int) $db->sql_fetchfield('total_entries');
- $db->sql_freeresult($result);
+ if ($log_count !== false)
+ {
+ $sql = 'SELECT COUNT(l.log_id) AS total_entries
+ FROM ' . LOG_TABLE . ' l, ' . USERS_TABLE . " u
+ WHERE l.log_type = $log_type
+ AND l.user_id = u.user_id
+ AND l.log_time >= $limit_days
+ $sql_keywords
+ $sql_forum";
+ $result = $db->sql_query($sql);
+ $log_count = (int) $db->sql_fetchfield('total_entries');
+ $db->sql_freeresult($result);
+ }
return;
}