summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorbugreport%peshkin.net <>2005-02-21 02:03:09 +0100
committerbugreport%peshkin.net <>2005-02-21 02:03:09 +0100
commit30a52319c024fefb2b4e4aa7bd974e4af7af30cd (patch)
tree4ee72b234e27753d291454020d97cc03e8f51a94 /Bugzilla
parentc1d16e426c2d1f2fe5563c0d20b3b8eb256d8c77 (diff)
downloadbugzilla-30a52319c024fefb2b4e4aa7bd974e4af7af30cd.tar.gz
bugzilla-30a52319c024fefb2b4e4aa7bd974e4af7af30cd.tar.xz
Bug 252272: Allow extremely large attachments to be stored locally
r=wurblzap.a=justdave
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Attachment.pm12
-rw-r--r--Bugzilla/Config.pm4
2 files changed, 15 insertions, 1 deletions
diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm
index e7b3ffe86..5f491f315 100644
--- a/Bugzilla/Attachment.pm
+++ b/Bugzilla/Attachment.pm
@@ -33,6 +33,7 @@ package Bugzilla::Attachment;
# Use the Flag module to handle flags.
use Bugzilla::Flag;
+use Bugzilla::Config qw(:locations);
############################################################################
# Functions
@@ -92,6 +93,17 @@ sub query
# Retrieve a list of flags for this attachment.
$a{'flags'} = Bugzilla::Flag::match({ 'attach_id' => $a{'attachid'},
'is_active' => 1 });
+
+ # A zero size indicates that the attachment is stored locally.
+ if ($a{'datasize'} == 0) {
+ my $attachid = $a{'attachid'};
+ my $hash = ($attachid % 100) + 100;
+ $hash =~ s/.*(\d\d)$/group.$1/;
+ if (open(AH, "$attachdir/$hash/attachment.$attachid")) {
+ $a{'datasize'} = (stat(AH))[7];
+ close(AH);
+ }
+ }
# We will display the edit link if the user can edit the attachment;
# ie the are the submitter, or they have canedit.
diff --git a/Bugzilla/Config.pm b/Bugzilla/Config.pm
index 5c070e372..3849f146b 100644
--- a/Bugzilla/Config.pm
+++ b/Bugzilla/Config.pm
@@ -55,6 +55,7 @@ use Bugzilla::Util;
our $libpath = '.';
our $localconfig = "$libpath/localconfig";
our $datadir = "$libpath/data";
+our $attachdir = "$datadir/attachments";
our $templatedir = "$libpath/template";
our $webdotdir = "$datadir/webdot";
@@ -72,7 +73,8 @@ our $webdotdir = "$datadir/webdot";
(
admin => [qw(GetParamList UpdateParams SetParam WriteParams)],
db => [qw($db_driver $db_host $db_port $db_name $db_user $db_pass $db_sock)],
- locations => [qw($libpath $localconfig $datadir $templatedir $webdotdir)],
+ locations => [qw($libpath $localconfig $attachdir
+ $datadir $templatedir $webdotdir)],
);
Exporter::export_ok_tags('admin', 'db', 'locations');