summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Template.pm
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-03-14 01:32:32 +0100
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-03-14 01:32:32 +0100
commit217beee45f5ba22aea80c8a61a639b55fe53293c (patch)
treee7865b6ac2b112cb6f5e22f6cb5d4e7aa77fe3f8 /Bugzilla/Template.pm
parentf276a11f82d1670eea4014f4d87b289d4b7921ca (diff)
downloadbugzilla-217beee45f5ba22aea80c8a61a639b55fe53293c.tar.gz
bugzilla-217beee45f5ba22aea80c8a61a639b55fe53293c.tar.xz
Bug 498309: Speed up show_bug.cgi when there are many comments by caching
field-descs globally for all template calls r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla/Template.pm')
-rw-r--r--Bugzilla/Template.pm7
1 files changed, 6 insertions, 1 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index 79382ece2..618af4726 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -236,7 +236,7 @@ sub quoteUrls {
# we have to do this in one pattern, and so this is semi-messy.
# Also, we can't use $bug_re?$comment_re? because that will match the
# empty string
- my $bug_word = get_text('term', { term => 'bug' });
+ my $bug_word = template_var('terms')->{bug};
my $bug_re = qr/\Q$bug_word\E\s*\#?\s*(\d+)/i;
my $comment_re = qr/comment\s*\#?\s*(\d+)/i;
$text =~ s~\b($bug_re(?:\s*,?\s*$comment_re)?|$comment_re)
@@ -774,6 +774,11 @@ sub create {
'feature_enabled' => sub { return Bugzilla->feature(@_); },
+ # field_descs can be somewhat slow to generate, so we generate
+ # it only once per-language no matter how many times
+ # $template->process() is called.
+ 'field_descs' => sub { return template_var('field_descs') },
+
'install_string' => \&Bugzilla::Install::Util::install_string,
# These don't work as normal constants.