summaryrefslogtreecommitdiffstats
path: root/attachment.cgi
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2012-11-28 09:40:21 +0100
committerByron Jones <bjones@mozilla.com>2012-11-28 09:40:21 +0100
commit1c5e0c47c92128afebef5614407d84cd72c12b35 (patch)
treefb192713a69dd8a61774f2fdb308a200d9a4e403 /attachment.cgi
parent4096dc51aadfa8344ae649c477827721a4c398ab (diff)
downloadbugzilla-1c5e0c47c92128afebef5614407d84cd72c12b35.tar.gz
bugzilla-1c5e0c47c92128afebef5614407d84cd72c12b35.tar.xz
Bug 814411: Add a caching mechanism to Bugzilla::Object to avoid querying the database repeatedly for the same information
Diffstat (limited to 'attachment.cgi')
-rwxr-xr-xattachment.cgi6
1 files changed, 3 insertions, 3 deletions
diff --git a/attachment.cgi b/attachment.cgi
index 985430d85..b5c0f8efe 100755
--- a/attachment.cgi
+++ b/attachment.cgi
@@ -180,7 +180,7 @@ sub validateID {
{ attach_id => scalar $cgi->param($param) });
# Make sure the attachment exists in the database.
- my $attachment = new Bugzilla::Attachment($attach_id)
+ my $attachment = new Bugzilla::Attachment({ id => $attach_id, cache => 1 })
|| ThrowUserError("invalid_attach_id", { attach_id => $attach_id });
return $attachment if ($dont_validate_access || check_can_access($attachment));
@@ -192,7 +192,7 @@ sub check_can_access {
my $user = Bugzilla->user;
# Make sure the user is authorized to access this attachment's bug.
- Bugzilla::Bug->check($attachment->bug_id);
+ Bugzilla::Bug->check({ id => $attachment->bug_id, cache => 1 });
if ($attachment->isprivate && $user->id != $attachment->attacher->id
&& !$user->is_insider)
{
@@ -454,7 +454,7 @@ sub diff {
# HTML page.
sub viewall {
# Retrieve and validate parameters
- my $bug = Bugzilla::Bug->check(scalar $cgi->param('bugid'));
+ my $bug = Bugzilla::Bug->check({ id => scalar $cgi->param('bugid'), cache => 1 });
my $bugid = $bug->id;
my $attachments = Bugzilla::Attachment->get_attachments_by_bug($bugid);