summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Template.pm
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-05-02 15:39:05 +0200
committerDylan William Hardison <dylan@hardison.net>2017-05-02 15:42:12 +0200
commit96ef286867ca2e8b81e5c4f0e3e1bc180e84539c (patch)
tree227d4835d548c29a282c8b3601535f3dc947cfa3 /Bugzilla/Template.pm
parente6423e215ca33695d93dcae2a9151b064052f145 (diff)
downloadbugzilla-96ef286867ca2e8b81e5c4f0e3e1bc180e84539c.tar.gz
bugzilla-96ef286867ca2e8b81e5c4f0e3e1bc180e84539c.tar.xz
Revert "Bug 1352264 - Preload all templates"
Diffstat (limited to 'Bugzilla/Template.pm')
-rw-r--r--Bugzilla/Template.pm23
1 files changed, 6 insertions, 17 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index 5a14a8e85..b08cffbde 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -12,7 +12,6 @@ use 5.10.1;
use strict;
use warnings;
-use Bugzilla::Template::PreloadProvider;
use Bugzilla::Bug;
use Bugzilla::Constants;
use Bugzilla::Hook;
@@ -48,8 +47,6 @@ use constant FORMAT_3_SIZE => [19,28,28];
use constant FORMAT_DOUBLE => '%19s %-55s';
use constant FORMAT_2_SIZE => [19,55];
-my %SHARED_PROVIDERS;
-
# Pseudo-constant.
sub SAFE_URL_REGEXP {
my $safe_protocols = join('|', SAFE_PROTOCOLS);
@@ -976,12 +973,10 @@ sub create {
PLUGIN_BASE => 'Bugzilla::Template::Plugin',
+ CONSTANTS => _load_constants(),
+
# Default variables for all templates
VARIABLES => {
- # Some of these are not really constants, and doing this messes up preloading.
- # they are now fake constants.
- constants => _load_constants(),
-
# Function for retrieving global parameters.
'Param' => sub { return Bugzilla->params->{$_[0]}; },
@@ -1120,18 +1115,12 @@ sub create {
'is_mobile_browser' => sub { return Bugzilla->cgi->user_agent =~ /Mobi/ },
},
};
-
- # under mod_perl, use a provider (template loader) that preloads all templates into memory
- my $provider_class
- = $ENV{MOD_PERL}
- ? 'Bugzilla::Template::PreloadProvider'
- : 'Template::Provider';
-
# Use a per-process provider to cache compiled templates in memory across
# requests.
my $provider_key = join(':', @{ $config->{INCLUDE_PATH} });
- $SHARED_PROVIDERS{$provider_key} ||= $provider_class->new($config);
- $config->{LOAD_TEMPLATES} = [ $SHARED_PROVIDERS{$provider_key} ];
+ my $shared_providers = Bugzilla->process_cache->{shared_providers} ||= {};
+ $shared_providers->{$provider_key} ||= Template::Provider->new($config);
+ $config->{LOAD_TEMPLATES} = [ $shared_providers->{$provider_key} ];
# BMO - use metrics subclass
local $Template::Config::CONTEXT = Bugzilla->metrics_enabled()
@@ -1220,7 +1209,7 @@ sub precompile_templates {
delete Bugzilla->request_cache->{template};
# Clear out the cached Provider object
- %SHARED_PROVIDERS = ();
+ Bugzilla->process_cache->{shared_providers} = undef;
print install_string('done') . "\n" if $output;
}