From 1c5e0c47c92128afebef5614407d84cd72c12b35 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Wed, 28 Nov 2012 16:40:21 +0800 Subject: Bug 814411: Add a caching mechanism to Bugzilla::Object to avoid querying the database repeatedly for the same information --- 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 18560c3f5..5d70cb73f 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -281,7 +281,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 = ""; @@ -333,8 +333,8 @@ sub get_bug_link { $options->{user} ||= Bugzilla->user; my $dbh = Bugzilla->dbh; - if (defined $bug) { - $bug = blessed($bug) ? $bug : new Bugzilla::Bug($bug); + if (defined $bug && $bug ne '') { + $bug = blessed($bug) ? $bug : new Bugzilla::Bug({ id => $bug, cache => 1 }); return $link_text if $bug->{error}; } -- cgit v1.2.3-24-g4f1b