Commit 4badf488 authored by c1541@hotmail.com's avatar c1541@hotmail.com Committed by Frédéric Buclin

Bug 684225: The removal of locally stored attachments should be done from…

Bug 684225: The removal of locally stored attachments should be done from Bugzilla::Attachment->remove_from_db r/a=LpSolit
parent 65b467bd
...@@ -900,6 +900,11 @@ sub remove_from_db { ...@@ -900,6 +900,11 @@ sub remove_from_db {
$dbh->do('UPDATE attachments SET mimetype = ?, ispatch = ?, isobsolete = ? $dbh->do('UPDATE attachments SET mimetype = ?, ispatch = ?, isobsolete = ?
WHERE attach_id = ?', undef, ('text/plain', 0, 1, $self->id)); WHERE attach_id = ?', undef, ('text/plain', 0, 1, $self->id));
$dbh->bz_commit_transaction(); $dbh->bz_commit_transaction();
my $filename = $self->_get_local_filename;
if (-e $filename) {
unlink $filename or warn "Couldn't unlink $filename: $!";
}
} }
############################### ###############################
......
...@@ -795,10 +795,6 @@ sub delete_attachment { ...@@ -795,10 +795,6 @@ sub delete_attachment {
# Paste the reason provided by the admin into a comment. # Paste the reason provided by the admin into a comment.
$bug->add_comment($msg); $bug->add_comment($msg);
# If the attachment is stored locally, remove it.
if (-e $attachment->_get_local_filename) {
unlink $attachment->_get_local_filename;
}
$attachment->remove_from_db(); $attachment->remove_from_db();
# Now delete the token. # Now delete the token.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment