1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-05 08:17:47 +02:00

Fix bug #48265 - Correctly set attachment flag for topics, posts and pms after deleting attachments - Patch by WorldWar and nickvergessen

Authorised by: AcydBurn


git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9843 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Joas Schilling
2009-07-24 09:01:29 +00:00
parent 433f03107d
commit 780854818b
6 changed files with 116 additions and 13 deletions

View File

@@ -1549,6 +1549,21 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
break;
}
if (($post_mode == 'delete') || ($post_mode == 'delete_last_post') || ($post_mode == 'delete_first_post'))
{
$sql = 'SELECT 1 AS has_attachments
FROM ' . ATTACHMENTS_TABLE . '
WHERE ' . $db->sql_in_set('topic_id', $topic_ids);
$result = $db->sql_query($sql);
$has_attachments = (int) $db->sql_fetchfield('has_attachments');
$db->sql_freeresult($result);
if (!$has_attachments)
{
$sql_data[TOPICS_TABLE] .= ', topic_attachment = 0';
}
}
// $sql_data[USERS_TABLE] = ($data['post_postcount']) ? 'user_posts = user_posts - 1' : '';
$db->sql_transaction('begin');