summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2006-04-18 05:19:35 +0200
committerlpsolit%gmail.com <>2006-04-18 05:19:35 +0200
commit246f6778660fe4a878b1f08eee175b1076c5e224 (patch)
treeea21520a5859f2820eefdefa74829783cc3116a9 /Bugzilla
parent3811d9d8a825a4aadaea2ac8e489d410fe408e28 (diff)
downloadbugzilla-246f6778660fe4a878b1f08eee175b1076c5e224.tar.gz
bugzilla-246f6778660fe4a878b1f08eee175b1076c5e224.tar.xz
Bug 44595: Implement an interface for administrators to delete attachments - Patch by Frédéric Buclin <LpSolit@gmail.com> r=wicked, justdave a=justdave
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Attachment.pm12
-rw-r--r--Bugzilla/Config/Attachment.pm5
2 files changed, 11 insertions, 6 deletions
diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm
index 350adfd72..00c7ee470 100644
--- a/Bugzilla/Attachment.pm
+++ b/Bugzilla/Attachment.pm
@@ -339,16 +339,16 @@ sub datasize {
# If we have already retrieved the data, return its size.
return length($self->{data}) if exists $self->{data};
- ($self->{datasize}) =
+ $self->{datasize} =
Bugzilla->dbh->selectrow_array("SELECT LENGTH(thedata)
FROM attach_data
WHERE id = ?",
- undef,
- $self->{id});
+ undef, $self->{id}) || 0;
- # If there's no attachment data in the database, the attachment
- # is stored in a local file, so retrieve its size from the file.
- if ($self->{datasize} == 0) {
+ # If there's no attachment data in the database, either the attachment
+ # is stored in a local file, and so retrieve its size from the file,
+ # or the attachment has been deleted.
+ unless ($self->{datasize}) {
if (open(AH, $self->_get_local_filename())) {
binmode AH;
$self->{datasize} = (stat(AH))[7];
diff --git a/Bugzilla/Config/Attachment.pm b/Bugzilla/Config/Attachment.pm
index 449908528..bbaaaa63d 100644
--- a/Bugzilla/Config/Attachment.pm
+++ b/Bugzilla/Config/Attachment.pm
@@ -41,6 +41,11 @@ sub get_param_list {
my $class = shift;
my @param_list = (
{
+ name => 'allow_attachment_deletion',
+ type => 'b',
+ default => 0
+ },
+ {
name => 'allow_attach_url',
type => 'b',
default => 0