aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_admin.php
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2011-02-24 20:30:52 -0500
committerOleg Pudeyev <oleg@bsdpower.com>2011-02-24 20:30:52 -0500
commit441755bf170e49799e311c71b2123ff263970d62 (patch)
treec26c6e022587ec068b2dc17d9163690d0fcebc49 /phpBB/includes/functions_admin.php
parent5a5560d2004bbf93a24d05353fe6f765311a991a (diff)
parenta25238e0c16ba238136475bb1dcc17472fedfffa (diff)
downloadforums-441755bf170e49799e311c71b2123ff263970d62.tar
forums-441755bf170e49799e311c71b2123ff263970d62.tar.gz
forums-441755bf170e49799e311c71b2123ff263970d62.tar.bz2
forums-441755bf170e49799e311c71b2123ff263970d62.tar.xz
forums-441755bf170e49799e311c71b2123ff263970d62.zip
Merge branch 'ticket/nickvergessen/9874' into develop-olympus
* ticket/nickvergessen/9874: [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 2aa12adb2e..cb0cf34e69 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;
}