diff options
author | Byron Jones <bjones@mozilla.com> | 2012-11-28 09:40:21 +0100 |
---|---|---|
committer | Byron Jones <bjones@mozilla.com> | 2012-11-28 09:40:21 +0100 |
commit | 1c5e0c47c92128afebef5614407d84cd72c12b35 (patch) | |
tree | fb192713a69dd8a61774f2fdb308a200d9a4e403 /extensions/Splinter/lib | |
parent | 4096dc51aadfa8344ae649c477827721a4c398ab (diff) | |
download | bugzilla-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 'extensions/Splinter/lib')
-rw-r--r-- | extensions/Splinter/lib/Util.pm | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/extensions/Splinter/lib/Util.pm b/extensions/Splinter/lib/Util.pm index 6305395f9..9f09d3dcc 100644 --- a/extensions/Splinter/lib/Util.pm +++ b/extensions/Splinter/lib/Util.pm @@ -53,7 +53,8 @@ sub attachment_id_is_valid { detaint_natural($attach_id) || return 0; # Make sure the attachment exists in the database. - my $attachment = new Bugzilla::Attachment($attach_id) || return 0; + my $attachment = new Bugzilla::Attachment({ id => $attach_id, cache => 1 }) + || return 0; return $attachment if ($dont_validate_access || attachment_is_visible($attachment)); @@ -135,7 +136,7 @@ sub add_review_links_to_email { if ($email->header('Subject') =~ /^\[Bug\s+(\d+)\]/ && Bugzilla->user->can_see_bug($1)) { - $bug = Bugzilla::Bug->new($1); + $bug = Bugzilla::Bug->new({ id => $1, cache => 1 }); } return unless defined $bug; |