summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Attachment/FileSystem.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla/Attachment/FileSystem.pm')
-rw-r--r--Bugzilla/Attachment/FileSystem.pm52
1 files changed, 26 insertions, 26 deletions
diff --git a/Bugzilla/Attachment/FileSystem.pm b/Bugzilla/Attachment/FileSystem.pm
index a9fdf83b6..f10a994fd 100644
--- a/Bugzilla/Attachment/FileSystem.pm
+++ b/Bugzilla/Attachment/FileSystem.pm
@@ -14,50 +14,50 @@ use warnings;
use Bugzilla::Constants qw(bz_locations);
sub new {
- return bless({}, shift);
+ return bless({}, shift);
}
sub store {
- my ($self, $attach_id, $data) = @_;
- my $path = _local_path($attach_id);
- mkdir($path, 0770) unless -d $path;
- open(my $fh, '>', _local_file($attach_id));
- binmode($fh);
- print $fh $data;
- close($fh);
+ my ($self, $attach_id, $data) = @_;
+ my $path = _local_path($attach_id);
+ mkdir($path, 0770) unless -d $path;
+ open(my $fh, '>', _local_file($attach_id));
+ binmode($fh);
+ print $fh $data;
+ close($fh);
}
sub retrieve {
- my ($self, $attach_id) = @_;
- if (open(my $fh, '<', _local_file($attach_id))) {
- local $/;
- binmode($fh);
- my $data = <$fh>;
- close($fh);
- return $data;
- }
- return undef;
+ my ($self, $attach_id) = @_;
+ if (open(my $fh, '<', _local_file($attach_id))) {
+ local $/;
+ binmode($fh);
+ my $data = <$fh>;
+ close($fh);
+ return $data;
+ }
+ return undef;
}
sub remove {
- my ($self, $attach_id) = @_;
- unlink(_local_file($attach_id));
+ my ($self, $attach_id) = @_;
+ unlink(_local_file($attach_id));
}
sub exists {
- my ($self, $attach_id) = @_;
- return -e _local_file($attach_id);
+ my ($self, $attach_id) = @_;
+ return -e _local_file($attach_id);
}
sub _local_path {
- my ($attach_id) = @_;
- my $hash = sprintf('group.%03d', $attach_id % 1000);
- return bz_locations()->{attachdir} . '/' . $hash;
+ my ($attach_id) = @_;
+ my $hash = sprintf('group.%03d', $attach_id % 1000);
+ return bz_locations()->{attachdir} . '/' . $hash;
}
sub _local_file {
- my ($attach_id) = @_;
- return _local_path($attach_id) . '/attachment.' . $attach_id;
+ my ($attach_id) = @_;
+ return _local_path($attach_id) . '/attachment.' . $attach_id;
}
1;