diff options
author | 2009-06-21 19:40:36 +0000 | |
---|---|---|
committer | 2009-06-21 19:40:36 +0000 | |
commit | e0e472a5e6c087966eb74c69d1bbfed53e4fb625 (patch) | |
tree | b854d076411f77452869b78af34bb3712264e0bf | |
parent | Bug 339679: describecomponents.cgi doesn't show components of closed products... (diff) | |
download | bugzilla-e0e472a5e6c087966eb74c69d1bbfed53e4fb625.tar.gz bugzilla-e0e472a5e6c087966eb74c69d1bbfed53e4fb625.tar.bz2 bugzilla-e0e472a5e6c087966eb74c69d1bbfed53e4fb625.zip |
Bug 498318: Speed up field-descs.none.tmpl
Patch by Bradley Baetz <bbaetz@acm.org> r=mkanat, a=mkanat
-rw-r--r-- | Bugzilla/Template.pm | 8 | ||||
-rw-r--r-- | template/en/default/global/field-descs.none.tmpl | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index 1362ecae3..261a8441a 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -748,6 +748,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 => diff --git a/template/en/default/global/field-descs.none.tmpl b/template/en/default/global/field-descs.none.tmpl index 344dc5528..e2c04a0a6 100644 --- a/template/en/default/global/field-descs.none.tmpl +++ b/template/en/default/global/field-descs.none.tmpl @@ -92,7 +92,7 @@ [% UNLESS Param('shutdownhtml') %] [% USE Bugzilla %] - [% FOREACH bz_field = Bugzilla.get_fields() %] + [% FOREACH bz_field = bug_fields.values %] [% SET field_descs.${bz_field.name} = bz_field.description IF !field_descs.${bz_field.name}.defined %] [% END %] |