mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-24 18:41:52 +02:00
[feature/soft-delete] Fix sync() and some more functions to use the new fields
PHPBB3-9567
This commit is contained in:
@@ -621,29 +621,31 @@ class acp_users
|
||||
$topic_id_ary = $move_topic_ary = $move_post_ary = $new_topic_id_ary = array();
|
||||
$forum_id_ary = array($new_forum_id);
|
||||
|
||||
$sql = 'SELECT topic_id, COUNT(post_id) AS total_posts
|
||||
$sql = 'SELECT topic_id, post_visibility, COUNT(post_id) AS total_posts
|
||||
FROM ' . POSTS_TABLE . "
|
||||
WHERE poster_id = $user_id
|
||||
AND forum_id <> $new_forum_id
|
||||
GROUP BY topic_id";
|
||||
GROUP BY topic_id, post_visibility";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$topic_id_ary[$row['topic_id']] = $row['total_posts'];
|
||||
$topic_id_ary[$row['topic_id']][$row['post_visibility']] = $row['total_posts'];
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
if (sizeof($topic_id_ary))
|
||||
{
|
||||
$sql = 'SELECT topic_id, forum_id, topic_title, topic_replies, topic_replies_real, topic_attachment
|
||||
$sql = 'SELECT topic_id, forum_id, topic_title, topic_posts, topic_posts_unapproved, topic_posts_softdeleted, topic_attachment
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('topic_id', array_keys($topic_id_ary));
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
if (max($row['topic_replies'], $row['topic_replies_real']) + 1 == $topic_id_ary[$row['topic_id']])
|
||||
if ($topic_id_ary[$row['topic_id']][ITEM_APPROVED] == $row['topic_posts']
|
||||
&& $topic_id_ary[$row['topic_id']][ITEM_UNAPPROVED] == $row['topic_posts_unapproved']
|
||||
&& $topic_id_ary[$row['topic_id']][ITEM_DELETED] == $row['topic_posts_softdeleted'])
|
||||
{
|
||||
$move_topic_ary[] = $row['topic_id'];
|
||||
}
|
||||
|
Reference in New Issue
Block a user