mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
synchronise post count in steps
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8912 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
4a3db854b7
commit
9bb0d6e76d
1 changed files with 31 additions and 8 deletions
|
@ -184,17 +184,40 @@ class acp_main
|
||||||
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
|
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Resync post counts
|
||||||
|
$start = 0;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
$sql = 'SELECT COUNT(p.post_id) AS num_posts, u.user_id
|
$sql = 'SELECT COUNT(p.post_id) AS num_posts, u.user_id
|
||||||
FROM ' . USERS_TABLE . ' u
|
FROM ' . USERS_TABLE . ' u
|
||||||
LEFT JOIN ' . POSTS_TABLE . ' p ON (u.user_id = p.poster_id AND p.post_postcount = 1 AND p.post_approved = 1)
|
LEFT JOIN ' . POSTS_TABLE . ' p ON (u.user_id = p.poster_id AND p.post_postcount = 1 AND p.post_approved = 1)
|
||||||
GROUP BY u.user_id';
|
GROUP BY u.user_id
|
||||||
$result = $db->sql_query($sql);
|
ORDER BY u.user_id ASC';
|
||||||
|
$result = $db->sql_query_limit($sql, 200, $start);
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
if ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$db->sql_query('UPDATE ' . USERS_TABLE . " SET user_posts = {$row['num_posts']} WHERE user_id = {$row['user_id']}");
|
$i = 0;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
$sql = 'UPDATE ' . USERS_TABLE . " SET user_posts = {$row['num_posts']} WHERE user_id = {$row['user_id']}";
|
||||||
|
_sql($sql, $errored, $error_ary);
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
while ($row = $db->sql_fetchrow($result));
|
||||||
|
|
||||||
|
$start = ($i < 200) ? 0 : $start + 200;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$start = 0;
|
||||||
}
|
}
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
}
|
||||||
|
while ($start);
|
||||||
|
|
||||||
add_log('admin', 'LOG_RESYNC_POSTCOUNTS');
|
add_log('admin', 'LOG_RESYNC_POSTCOUNTS');
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue