summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Quantum.pm
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-05-22 04:18:27 +0200
committerDylan William Hardison <dylan@hardison.net>2018-06-28 22:41:58 +0200
commit2474b97150add16474f3071faeffc8faa4bff953 (patch)
treea7b90e6fdc5fc9832672c9793a62085f9526861e /Bugzilla/Quantum.pm
parent94f0bad3fb3158c99668550fb0640fcd89b4bf18 (diff)
downloadbugzilla-2474b97150add16474f3071faeffc8faa4bff953.tar.gz
bugzilla-2474b97150add16474f3071faeffc8faa4bff953.tar.xz
support HTTPD_IN_SUBDIR for tests
Diffstat (limited to 'Bugzilla/Quantum.pm')
-rw-r--r--Bugzilla/Quantum.pm25
1 files changed, 25 insertions, 0 deletions
diff --git a/Bugzilla/Quantum.pm b/Bugzilla/Quantum.pm
index 299b4bf42..7d679e3c3 100644
--- a/Bugzilla/Quantum.pm
+++ b/Bugzilla/Quantum.pm
@@ -22,6 +22,7 @@ use Bugzilla::Extension ();
use Bugzilla::Install::Requirements ();
use Bugzilla::Util ();
use Bugzilla::RNG ();
+use JSON::MaybeXS qw(decode_json);
use Cwd qw(realpath);
use MojoX::Log::Log4perl::Tiny;
@@ -30,6 +31,30 @@ has 'static' => sub { Bugzilla::Quantum::Static->new };
sub startup {
my ($self) = @_;
+ 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";
+ }
+ }
+ }
+
+ $self->hook(
+ before_dispatch => sub {
+ my $c = shift;
+
+ if ($D{HTTPD_IN_SUBDIR}) {
+ my $path = $c->req->url->path;
+ $path =~ s{^/bmo}{}s;
+ $c->req->url->path($path);
+ }
+ }
+ );
my $extensions = Bugzilla::Extension->load_all();
Bugzilla->preload_features();