summaryrefslogtreecommitdiffstats
path: root/Bugzilla.pm
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-07-23 17:25:43 +0200
committerGitHub <noreply@github.com>2018-07-23 17:25:43 +0200
commit345e686485e484e087ea58c988e4831209c39554 (patch)
tree6888ff14ec3d34cfe21d64d520421ba94918a25b /Bugzilla.pm
parente8c0dfe232ce1efe78f8dd7cf6b78c24b96786e8 (diff)
downloadbugzilla-345e686485e484e087ea58c988e4831209c39554.tar.gz
bugzilla-345e686485e484e087ea58c988e4831209c39554.tar.xz
Bug 1476841 - Various code cleanups ahead of the Mojolicious patch
Diffstat (limited to 'Bugzilla.pm')
-rw-r--r--Bugzilla.pm28
1 files changed, 13 insertions, 15 deletions
diff --git a/Bugzilla.pm b/Bugzilla.pm
index 29675865b..73d080395 100644
--- a/Bugzilla.pm
+++ b/Bugzilla.pm
@@ -13,15 +13,6 @@ use warnings;
use Bugzilla::Logging;
-# We want any compile errors to get to the browser, if possible.
-BEGIN {
- # This makes sure we're in a CGI.
- if ($ENV{SERVER_SOFTWARE} && !$ENV{MOD_PERL}) {
- require CGI::Carp;
- CGI::Carp->import('fatalsToBrowser');
- }
-}
-
our $VERSION = '20180717.2';
use Bugzilla::Auth;
@@ -202,8 +193,17 @@ sub init_page {
# Subroutines and Methods
#####################################################################
+my $preload_templates = 0;
+sub preload_templates {
+ $preload_templates = 1;
+
+ delete request_cache->{template};
+ template();
+ return 1;
+}
+
sub template {
- request_cache->{template} ||= Bugzilla::Template->create();
+ request_cache->{template} //= Bugzilla::Template->create(preload => $preload_templates);
request_cache->{template}->{_is_main} = 1;
return request_cache->{template};
@@ -214,7 +214,8 @@ sub template_inner {
my $cache = request_cache;
my $current_lang = $cache->{template_current_lang}->[0];
$lang ||= $current_lang || '';
- return $cache->{"template_inner_$lang"} ||= Bugzilla::Template->create(language => $lang);
+ my %options = (language => $lang, preload => $preload_templates);
+ return $cache->{"template_inner_$lang"} ||= Bugzilla::Template->create(%options);
}
sub extensions {
@@ -234,7 +235,7 @@ sub extensions {
}
sub cgi {
- return request_cache->{cgi} ||= new Bugzilla::CGI();
+ return request_cache->{cgi} ||= Bugzilla::CGI->new;
}
sub input_params {
@@ -340,9 +341,6 @@ sub login {
return $class->user if $class->user->id;
- # Load all extensions here if not running under mod_perl
- $class->extensions unless $ENV{MOD_PERL};
-
my $authorizer = new Bugzilla::Auth();
$type = LOGIN_REQUIRED if $class->cgi->param('GoAheadAndLogIn');