mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 21:38:54 +00:00
Merge branch 'ticket/callumacrae/9872' into develop-olympus
* ticket/callumacrae/9872: [ticket/9872] Removed some useless code that broke delete_posts
This commit is contained in:
commit
e6ed55a9c1
1 changed files with 0 additions and 38 deletions
|
@ -482,44 +482,6 @@ function user_delete($mode, $user_id, $post_username = false)
|
|||
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
|
||||
}
|
||||
|
||||
$sql = 'SELECT topic_id, COUNT(post_id) AS total_posts
|
||||
FROM ' . POSTS_TABLE . "
|
||||
WHERE poster_id = $user_id
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
// Delete posts, attachments, etc.
|
||||
delete_posts('poster_id', $user_id);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue