summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Quantum.pm
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-05-19 06:34:01 +0200
committerDylan William Hardison <dylan@hardison.net>2018-06-28 22:41:55 +0200
commit10918f3336863623020a6d73e63a0f0a5eebb306 (patch)
treea496e36a1f149e193a4ceed41531034a6b2ae888 /Bugzilla/Quantum.pm
parent215f1021948b63cad29094e7847b52c256ec9974 (diff)
downloadbugzilla-10918f3336863623020a6d73e63a0f0a5eebb306.tar.gz
bugzilla-10918f3336863623020a6d73e63a0f0a5eebb306.tar.xz
mojo all the things
Diffstat (limited to 'Bugzilla/Quantum.pm')
-rw-r--r--Bugzilla/Quantum.pm59
1 files changed, 51 insertions, 8 deletions
diff --git a/Bugzilla/Quantum.pm b/Bugzilla/Quantum.pm
index 20050131f..bb7f06b55 100644
--- a/Bugzilla/Quantum.pm
+++ b/Bugzilla/Quantum.pm
@@ -8,43 +8,86 @@
package Bugzilla::Quantum;
use Mojo::Base 'Mojolicious';
+use CGI::Compile; # Primarily for its exit overload.
use Bugzilla::Quantum::CGI;
use Bugzilla::Quantum::Template;
use Bugzilla::Quantum::Legacy;
+use Bugzilla::Quantum::Static;
use Bugzilla::PSGI qw(compile_cgi);
use Bugzilla ();
-use Bugzilla::Constants ();
+use Bugzilla::Constants qw(bz_locations);
use Bugzilla::BugMail ();
use Bugzilla::CGI ();
use Bugzilla::Extension ();
use Bugzilla::Install::Requirements ();
use Bugzilla::Util ();
use Bugzilla::RNG ();
+use Cwd qw(realpath);
+
+has 'static' => sub { Bugzilla::Quantum::Static->new };
sub startup {
my ($self) = @_;
- Bugzilla::Extension->load_all();
+ my $extensions = Bugzilla::Extension->load_all();
Bugzilla->preload_features();
Bugzilla->template;
+ my $rest = compile_cgi('rest.cgi');
$self->plugin('Bugzilla::Quantum::Plugin::Glue');
-
$self->plugin(
'MountPSGI' => {
rewrite => 1,
'/rest' => $rest,
+ }
+ );
+ $self->plugin(
+ 'MountPSGI' => {
+ rewrite => 1,
'/rest.cgi' => $rest,
- '/jsonrpc.cgi' => compile_cgi('jsonrpc.cgi'),
+ }
+ );
+ $self->plugin(
+ 'MountPSGI' => {
+ rewrite => 1,
'/xmlrpc.cgi' => compile_cgi('xmlrpc.cgi'),
}
);
+ $self->plugin(
+ 'MountPSGI' => {
+rewrite => 1,
+ '/jsonrpc.cgi' => compile_cgi('jsonrpc.cgi'),
+ }
+ );
my $r = $self->routes;
+ Bugzilla::Quantum::Legacy->expose_routes($r);
+
+ $r->any('/')->to('Legacy#index_cgi');
- $r->any( '/' )->to('legacy#index_cgi');
- $r->any( '/show_bug.cgi' )->to('legacy#show_bug');
- $r->any('/bug/:id')->to('legacy#show_bug');
+ my $urlbase = Bugzilla->localconfig->{urlbase};
+ $r->get(
+ '/quicksearch.html' => sub {
+ my $c = shift;
+ $c->res->code(301);
+ $c->redirect_to( $urlbase . 'page.cgi?id=quicksearch.html' );
+ }
+ );
+ $r->get(
+ '/bugwritinghelp.html' => sub {
+ my $c = shift;
+ $c->res->code(301);
+ $c->redirect_to( $urlbase . 'page.cgi?id=bug-writing.html', 301 );
+ }
+ );
+ $r->get(
+ '/<bug_id:num>' => sub {
+ my $c = shift;
+ $c->res->code(301);
+ my $bug_id = $c->param('bug_id');
+ $c - redirect_to( $urlbase . "show_bug.cgi?id=$bug_id" );
+ }
+ );
}
-1; \ No newline at end of file
+1;