]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 498318: Speed up field-descs.none.tmpl
authormkanat%bugzilla.org <>
Sun, 21 Jun 2009 19:40:36 +0000 (19:40 +0000)
committermkanat%bugzilla.org <>
Sun, 21 Jun 2009 19:40:36 +0000 (19:40 +0000)
Patch by Bradley Baetz <bbaetz@acm.org> r=mkanat, a=mkanat

Bugzilla/Template.pm
template/en/default/global/field-descs.none.tmpl

index 1362ecae3e32f4f672dea68da11095ddfb3230f1..261a8441a3400c444284601dc2de9748a4e75542 100644 (file)
@@ -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 => 
index 344dc5528741621ffbef54aac1a10d9962d099f3..e2c04a0a6b62516cdc6fbc104efce8067fe6654a 100644 (file)
@@ -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 %]