aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_admin.php
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2011-02-24 20:59:19 -0500
committerOleg Pudeyev <oleg@bsdpower.com>2011-02-24 20:59:19 -0500
commitee0db1a1d5f0150016d0971057f889f2366f9856 (patch)
treeb08d0b98244541ba8b31fc3e24f01e883b08bcd2 /phpBB/includes/functions_admin.php
parent76ad7c938d7834c09c98b6759dca4a196eb3c29b (diff)
parent904bcb86a054ab6256da565098eb9bd8ab20414b (diff)
downloadforums-ee0db1a1d5f0150016d0971057f889f2366f9856.tar
forums-ee0db1a1d5f0150016d0971057f889f2366f9856.tar.gz
forums-ee0db1a1d5f0150016d0971057f889f2366f9856.tar.bz2
forums-ee0db1a1d5f0150016d0971057f889f2366f9856.tar.xz
forums-ee0db1a1d5f0150016d0971057f889f2366f9856.zip
Merge branch 'develop-olympus' into develop
* develop-olympus: [ticket/9874] view_log() performs unneeded count query over all log entries. [ticket/7834] Topic time didn't update when first post was deleted [ticket/9997] Fixed an inconsistency in the Moderator Control Panel [ticket/9872] Removed some useless code that broke delete_posts
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;
}