aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/acp/acp_main.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/acp/acp_main.php')
-rw-r--r--phpBB/includes/acp/acp_main.php36
1 files changed, 8 insertions, 28 deletions
diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php
index 5588f0dae9..4aedb63df6 100644
--- a/phpBB/includes/acp/acp_main.php
+++ b/phpBB/includes/acp/acp_main.php
@@ -209,37 +209,17 @@ class acp_main
trigger_error($user->lang['NO_ADMIN']);
}
- $post_count_ary = $auth->acl_getf('f_postcount');
- $forum_read_ary = $auth->acl_getf('f_read');
-
- $forum_ary = array();
- foreach ($post_count_ary as $forum_id => $allowed)
- {
- if ($allowed['f_postcount'] && $forum_read_ary[$forum_id]['f_read'])
- {
- $forum_ary[] = $forum_id;
- }
- }
+ $sql = 'SELECT COUNT(post_id) AS num_posts, poster_id
+ FROM ' . POSTS_TABLE . '
+ WHERE post_postcount = 1
+ GROUP BY poster_id';
+ $result = $db->sql_query($sql);
- if (!sizeof($forum_ary))
- {
- $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_posts = 0');
- }
- else
+ while ($row = $db->sql_fetchrow($result))
{
- $sql = 'SELECT COUNT(post_id) AS num_posts, poster_id
- FROM ' . POSTS_TABLE . '
- WHERE poster_id <> ' . ANONYMOUS . '
- AND forum_id IN (' . implode(', ', $forum_ary) . ')
- GROUP BY poster_id';
- $result = $db->sql_query($sql);
-
- while ($row = $db->sql_fetchrow($result))
- {
- $db->sql_query('UPDATE ' . USERS_TABLE . " SET user_posts = {$row['num_posts']} WHERE user_id = {$row['poster_id']}");
- }
- $db->sql_freeresult($result);
+ $db->sql_query('UPDATE ' . USERS_TABLE . " SET user_posts = {$row['num_posts']} WHERE user_id = {$row['poster_id']}");
}
+ $db->sql_freeresult($result);
add_log('admin', 'LOG_RESYNC_POSTCOUNTS');