1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

Correctly delete message attachments. (Bug #23755) Also revamped and simplified delete_attachments() - it looks like we did not touch it for a long long time.

git-svn-id: file:///svn/phpbb/trunk@8891 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2008-09-19 15:42:33 +00:00
parent 461be11e8d
commit eee2f89ace
2 changed files with 101 additions and 125 deletions

View File

@@ -977,6 +977,8 @@ function delete_pm($user_id, $msg_ids, $folder_id)
return false;
}
$db->sql_transaction('begin');
// if no one has read the message yet (meaning it is in users outbox)
// then mark the message as deleted...
if ($folder_id == PRIVMSGS_OUTBOX)
@@ -1054,11 +1056,21 @@ function delete_pm($user_id, $msg_ids, $folder_id)
if (sizeof($delete_ids))
{
// Check if there are any attachments we need to remove
if (!function_exists('delete_attachments'))
{
include(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT);
}
delete_attachments('message', $delete_ids, false);
$sql = 'DELETE FROM ' . PRIVMSGS_TABLE . '
WHERE ' . $db->sql_in_set('msg_id', $delete_ids);
$db->sql_query($sql);
}
$db->sql_transaction('commit');
return true;
}