mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 05:18:52 +00:00
Merge branch 'develop-ascraeus' into develop
This commit is contained in:
commit
4840584cd6
1 changed files with 26 additions and 2 deletions
|
@ -1114,6 +1114,7 @@ function mcp_fork_topic($topic_ids)
|
|||
$forum_id = request_var('f', 0);
|
||||
$redirect = request_var('redirect', build_url(array('action', 'quickmod')));
|
||||
$additional_msg = $success_msg = '';
|
||||
$counter = array();
|
||||
|
||||
$s_hidden_fields = build_hidden_fields(array(
|
||||
'topic_id_list' => $topic_ids,
|
||||
|
@ -1306,9 +1307,20 @@ function mcp_fork_topic($topic_ids)
|
|||
'post_edit_time' => (int) $row['post_edit_time'],
|
||||
'post_edit_count' => (int) $row['post_edit_count'],
|
||||
'post_edit_locked' => (int) $row['post_edit_locked'],
|
||||
'post_postcount' => 0,
|
||||
'post_postcount' => $row['post_postcount'],
|
||||
);
|
||||
|
||||
// Adjust post count only if the post can be incremented to the user counter
|
||||
if ($row['post_postcount'])
|
||||
{
|
||||
if (isset($counter[$row['poster_id']]))
|
||||
{
|
||||
++$counter[$row['poster_id']];
|
||||
}
|
||||
else
|
||||
{
|
||||
$counter[$row['poster_id']] = 1;
|
||||
}
|
||||
}
|
||||
$db->sql_query('INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
|
||||
$new_post_id = $db->sql_nextid();
|
||||
|
||||
|
@ -1428,6 +1440,18 @@ function mcp_fork_topic($topic_ids)
|
|||
WHERE forum_id = ' . $to_forum_id;
|
||||
$db->sql_query($sql);
|
||||
|
||||
if (!empty($counter))
|
||||
{
|
||||
// Do only one query per user and not a query per post.
|
||||
foreach ($counter as $user_id => $count)
|
||||
{
|
||||
$sql = 'UPDATE ' . USERS_TABLE . '
|
||||
SET user_posts = user_posts + ' . (int) $count . '
|
||||
WHERE user_id = ' . (int) $user_id;
|
||||
$db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
sync('topic', 'topic_id', $new_topic_id_list);
|
||||
sync('forum', 'forum_id', $to_forum_id);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue