From 4c3e00573133dfc53d07805629af19599aaef7df Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Thu, 22 Nov 2012 22:39:05 +0800 Subject: Bug 811280: Adds a caching mechanism to Bugzilla::Object to avoid querying the database repeatedly for the same information r=dkl,a=LpSolit --- Bugzilla/Template.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Bugzilla/Template.pm') diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index e13efec2b..f62a7c498 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -284,7 +284,7 @@ sub get_attachment_link { my $dbh = Bugzilla->dbh; $user ||= Bugzilla->user; - my $attachment = new Bugzilla::Attachment($attachid); + my $attachment = new Bugzilla::Attachment({ id => $attachid, cache => 1 }); if ($attachment) { my $title = ""; @@ -334,10 +334,10 @@ sub get_bug_link { $options->{user} ||= Bugzilla->user; my $dbh = Bugzilla->dbh; - if (defined $bug) { + if (defined $bug && $bug ne '') { if (!blessed($bug)) { require Bugzilla::Bug; - $bug = new Bugzilla::Bug($bug); + $bug = new Bugzilla::Bug({ id => $bug, cache => 1 }); } return $link_text if $bug->{error}; } -- cgit v1.2.3-24-g4f1b