summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Template.pm
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2009-06-21 21:36:52 +0200
committermkanat%bugzilla.org <>2009-06-21 21:36:52 +0200
commitd57c8562fc0490d560b0c6b4c45d80a6e98bd7e5 (patch)
tree75d87d1bb99fc12da00669fad84d6cbe34dd320f /Bugzilla/Template.pm
parent6a23b8335dd9e0786cf2c6ea90c8574ac0c6f28f (diff)
downloadbugzilla-d57c8562fc0490d560b0c6b4c45d80a6e98bd7e5.tar.gz
bugzilla-d57c8562fc0490d560b0c6b4c45d80a6e98bd7e5.tar.xz
Bug 498318: Speed up field-descs.none.tmpl
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=bbaetz, a=mkanat
Diffstat (limited to 'Bugzilla/Template.pm')
-rw-r--r--Bugzilla/Template.pm8
1 files changed, 8 insertions, 0 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index 3a46fad88..48cd90508 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -781,6 +781,14 @@ sub create {
# Allow templates to generate a token themselves.
'issue_hash_token' => \&Bugzilla::Token::issue_hash_token,
+ # A way for all templates to get at Field data, cached.
+ 'bug_fields' => sub {
+ my $cache = Bugzilla->request_cache;
+ $cache->{template_bug_fields} ||=
+ { map { $_->name => $_ } Bugzilla->get_fields() };
+ return $cache->{template_bug_fields};
+ },
+
# These don't work as normal constants.
DB_MODULE => \&Bugzilla::Constants::DB_MODULE,
REQUIRED_MODULES =>