From d57c8562fc0490d560b0c6b4c45d80a6e98bd7e5 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Sun, 21 Jun 2009 19:36:52 +0000 Subject: Bug 498318: Speed up field-descs.none.tmpl Patch by Max Kanat-Alexander r=bbaetz, a=mkanat --- Bugzilla/Template.pm | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Bugzilla/Template.pm') 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 => -- cgit v1.2.3-24-g4f1b