From: bbaetz%acm.org <> Date: Fri, 19 Jun 2009 02:08:41 +0000 (+0000) Subject: Bug 499121 - Cache user objects for Bug::GetComments X-Git-Tag: bugzilla-3.4rc1~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fca8b7c53704d504be7d11d4580f7403a62fadde;p=thirdparty%2Fbugzilla.git Bug 499121 - Cache user objects for Bug::GetComments r/a=mkanat --- diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index f1fc9c4248..b66ace54f5 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -3043,9 +3043,13 @@ sub GetComments { my $sth = $dbh->prepare($query); $sth->execute(@args); + # Cache the users we look up + my %users; + while (my $comment_ref = $sth->fetchrow_hashref()) { my %comment = %$comment_ref; - $comment{'author'} = new Bugzilla::User($comment{'userid'}); + $users{$comment{'userid'}} ||= new Bugzilla::User($comment{'userid'}); + $comment{'author'} = $users{$comment{'userid'}}; # If raw data is requested, do not format 'special' comments. $comment{'body'} = format_comment(\%comment) unless $raw;