summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Quantum/Plugin/Glue.pm
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-06-20 03:28:50 +0200
committerDylan William Hardison <dylan@hardison.net>2018-06-28 22:41:58 +0200
commite1b48df3b5cdd81920782a8585864af3b294e919 (patch)
tree13bb7c184950b6f1d911e387bbff817e42d1ee2d /Bugzilla/Quantum/Plugin/Glue.pm
parent561a205df8fdb1950df167c6915d52601630c08a (diff)
downloadbugzilla-e1b48df3b5cdd81920782a8585864af3b294e919.tar.gz
bugzilla-e1b48df3b5cdd81920782a8585864af3b294e919.tar.xz
lots of hacking
Diffstat (limited to 'Bugzilla/Quantum/Plugin/Glue.pm')
-rw-r--r--Bugzilla/Quantum/Plugin/Glue.pm44
1 files changed, 42 insertions, 2 deletions
diff --git a/Bugzilla/Quantum/Plugin/Glue.pm b/Bugzilla/Quantum/Plugin/Glue.pm
index 822987ad8..b46ffb1e1 100644
--- a/Bugzilla/Quantum/Plugin/Glue.pm
+++ b/Bugzilla/Quantum/Plugin/Glue.pm
@@ -11,12 +11,45 @@ use Mojo::Base 'Mojolicious::Plugin';
use Try::Tiny;
use Bugzilla::Constants;
use Bugzilla::Quantum::Template;
+use Bugzilla::Logging;
sub register {
my ( $self, $app, $conf ) = @_;
- my $template = Bugzilla::Template->create;
- $template->{_is_main} = 1;
+ my %D;
+ if ($ENV{BUGZILLA_HTTPD_ARGS}) {
+ my $args = decode_json($ENV{BUGZILLA_HTTPD_ARGS});
+ foreach my $arg (@$args) {
+ if ($arg =~ /^-D(\w+)$/) {
+ $D{$1} = 1;
+ }
+ else {
+ die "Unknown httpd arg: $arg";
+ }
+ }
+ }
+
+ $app->hook(
+ around_dispatch => sub {
+ my ($next, $c) = @_;
+
+ if ($D{HTTPD_IN_SUBDIR}) {
+ my $path = $c->req->url->path;
+ $path =~ s{^/bmo}{}s;
+ $c->req->url->path($path);
+ }
+ $next->();
+ }
+ );
+
+ Bugzilla::Extension->load_all();
+ if ($app->mode ne 'development') {
+ Bugzilla->preload_features();
+ DEBUG("preloading templates");
+ Bugzilla->preload_templates();
+ DEBUG("done preloading templates");
+ }
+ $app->secrets([Bugzilla->localconfig->{side_wide_secret}]);
$app->renderer->add_handler(
'bugzilla' => sub {
@@ -37,10 +70,17 @@ sub register {
unless ($name =~ /\./) {
$name = sprintf '%s.%s.tmpl', $options->{template}, $options->{format};
}
+ my $template = Bugzilla->template;
$template->process( $name, $vars, $output )
or die $template->error;
}
);
+
+ $app->log(
+ MojoX::Log::Log4perl::Tiny->new(
+ logger => Log::Log4perl->get_logger(ref $app)
+ )
+ );
}