From 04a6303527d9bf29114b51001d06af5235ea0847 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sun, 8 May 2011 03:01:38 -0400 Subject: [PATCH] [feature/prune-users] Apply e6ed55a9c1ceb07ab2e87d4a53f9e688fda319c5. This was done in PHPBB3-9872. PHPBB3-9622 --- phpBB/includes/functions_user.php | 41 +------------------------------ 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 0886e8aabf..9b16a56b1c 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -518,46 +518,7 @@ function user_delete($mode, $user_ids, $retain_username = true) include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); } - // Find any topics whose only posts are being deleted, and remove them from the topics table - $sql = 'SELECT topic_id, COUNT(post_id) AS total_posts - FROM ' . POSTS_TABLE . ' - WHERE ' . $db->sql_in_set('poster_id', $user_ids) . ' - GROUP BY topic_id'; - $result = $db->sql_query($sql); - - $topic_id_ary = array(); - while ($row = $db->sql_fetchrow($result)) - { - $topic_id_ary[$row['topic_id']] = $row['total_posts']; - } - $db->sql_freeresult($result); - - if (sizeof($topic_id_ary)) - { - $sql = 'SELECT topic_id, topic_replies, topic_replies_real - FROM ' . TOPICS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_id', array_keys($topic_id_ary)); - $result = $db->sql_query($sql); - - $del_topic_ary = array(); - while ($row = $db->sql_fetchrow($result)) - { - if (max($row['topic_replies'], $row['topic_replies_real']) + 1 == $topic_id_ary[$row['topic_id']]) - { - $del_topic_ary[] = $row['topic_id']; - } - } - $db->sql_freeresult($result); - - if (sizeof($del_topic_ary)) - { - $sql = 'DELETE FROM ' . TOPICS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_id', $del_topic_ary); - $db->sql_query($sql); - } - } - - // actually do the meat of the work if we are deleting all the users' posts + // Delete posts, attachments, etc. // delete_posts can handle any number of IDs in its second argument delete_posts('poster_id', $user_ids); }