diff options
author | Byron Jones <bjones@mozilla.com> | 2012-11-22 15:39:05 +0100 |
---|---|---|
committer | Byron Jones <bjones@mozilla.com> | 2012-11-22 15:39:05 +0100 |
commit | 4c3e00573133dfc53d07805629af19599aaef7df (patch) | |
tree | e9ce090e958fb60edee1656af12fa414ba79efc3 /attachment.cgi | |
parent | da12cec61f8c7e667b00fc5fc39c827d3593f021 (diff) | |
download | bugzilla-4c3e00573133dfc53d07805629af19599aaef7df.tar.gz bugzilla-4c3e00573133dfc53d07805629af19599aaef7df.tar.xz |
Bug 811280: Adds a caching mechanism to Bugzilla::Object to avoid querying the database repeatedly for the same information
r=dkl,a=LpSolit
Diffstat (limited to 'attachment.cgi')
-rwxr-xr-x | attachment.cgi | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/attachment.cgi b/attachment.cgi index 120cc2b45..7009a5e00 100755 --- a/attachment.cgi +++ b/attachment.cgi @@ -140,7 +140,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)); @@ -152,7 +152,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) { @@ -414,7 +414,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 $attachments = Bugzilla::Attachment->get_attachments_by_bug($bug); # Ignore deleted attachments. |