diff options
author | Dylan William Hardison <dylan@hardison.net> | 2018-07-23 17:16:47 +0200 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2018-08-20 23:52:50 +0200 |
commit | e84956b1f37a7248ebc5d43bd64e6360c257ad0f (patch) | |
tree | 92ebeaf7707b551d5876fd7732f65633ff92a616 /Bugzilla/Quantum.pm | |
parent | a46ca861f527d75fe28f784794207f50e8ec7f2b (diff) | |
download | bugzilla-e84956b1f37a7248ebc5d43bd64e6360c257ad0f.tar.gz bugzilla-e84956b1f37a7248ebc5d43bd64e6360c257ad0f.tar.xz |
some cleanups
Diffstat (limited to 'Bugzilla/Quantum.pm')
-rw-r--r-- | Bugzilla/Quantum.pm | 169 |
1 files changed, 23 insertions, 146 deletions
diff --git a/Bugzilla/Quantum.pm b/Bugzilla/Quantum.pm index b5ee83d8e..1f6dce8da 100644 --- a/Bugzilla/Quantum.pm +++ b/Bugzilla/Quantum.pm @@ -8,22 +8,22 @@ package Bugzilla::Quantum; use Mojo::Base 'Mojolicious'; -use CGI::Compile; # Needed for its exit() overload +# Needed for its exit() overload, must happen early in execution. +use CGI::Compile; + +use Bugzilla (); +use Bugzilla::BugMail (); +use Bugzilla::CGI (); +use Bugzilla::Constants qw(bz_locations); +use Bugzilla::Extension (); +use Bugzilla::Install::Requirements (); use Bugzilla::Logging; -use Bugzilla::Quantum::Template; use Bugzilla::Quantum::CGI; use Bugzilla::Quantum::SES; use Bugzilla::Quantum::Static; - -use Bugzilla (); -use Bugzilla::Constants qw(bz_locations); -use Bugzilla::BugMail (); -use Bugzilla::CGI (); -use Bugzilla::Extension (); -use Bugzilla::Install::Requirements (); +use Bugzilla::Quantum::Template; use Bugzilla::Util (); use Cwd qw(realpath); - use MojoX::Log::Log4perl::Tiny; has 'static' => sub { Bugzilla::Quantum::Static->new }; @@ -31,7 +31,7 @@ has 'static' => sub { Bugzilla::Quantum::Static->new }; sub startup { my ($self) = @_; - DEBUG("Starting up"); + DEBUG('Starting up'); $self->plugin('Bugzilla::Quantum::Plugin::Glue'); $self->plugin('Bugzilla::Quantum::Plugin::Hostage'); $self->plugin('Bugzilla::Quantum::Plugin::BlockIP'); @@ -48,12 +48,12 @@ sub startup { my $r = $self->routes; Bugzilla::Quantum::CGI->load_all($r); - Bugzilla::Quantum::CGI->load_one('bzapi_cgi', 'extensions/BzAPI/bin/rest.cgi'); + Bugzilla::Quantum::CGI->load_one( 'bzapi_cgi', 'extensions/BzAPI/bin/rest.cgi' ); $r->any('/')->to('CGI#index_cgi'); $r->any('/rest')->to('CGI#rest_cgi'); - $r->any('/rest.cgi/*PATH_INFO')->to('CGI#rest_cgi' => { PATH_INFO => '' }); - $r->any('/rest/*PATH_INFO')->to( 'CGI#rest_cgi' => { PATH_INFO => '' }); + $r->any('/rest.cgi/*PATH_INFO')->to( 'CGI#rest_cgi' => { PATH_INFO => '' } ); + $r->any('/rest/*PATH_INFO')->to( 'CGI#rest_cgi' => { PATH_INFO => '' } ); $r->any('/bug/:id')->to('CGI#show_bug_cgi'); $r->any('/extensions/BzAPI/bin/rest.cgi/*PATH_INFO')->to('CGI#bzapi_cgi'); @@ -64,16 +64,16 @@ sub startup { }, ); - $r->get('/__heartbeat__')->to( 'CGI#heartbeat_cgi'); - $r->get('/robots.txt')->to( 'CGI#robots_cgi' ); + $r->get('/__heartbeat__')->to('CGI#heartbeat_cgi'); + $r->get('/robots.txt')->to('CGI#robots_cgi'); - $r->any('/review')->to( 'CGI#page_cgi' => {'id' => 'splinter.html'}); - $r->any('/user_profile')->to( 'CGI#page_cgi' => {'id' => 'user_profile.html'}); - $r->any('/userprofile')->to( 'CGI#page_cgi' => {'id' => 'user_profile.html'}); - $r->any('/request_defer')->to( 'CGI#page_cgi' => {'id' => 'request_defer.html'}); - $r->any('/login')->to( 'CGI#index_cgi' => { 'GoAheadAndLogIn' => '1' }); + $r->any('/review')->to( 'CGI#page_cgi' => { 'id' => 'splinter.html' } ); + $r->any('/user_profile')->to( 'CGI#page_cgi' => { 'id' => 'user_profile.html' } ); + $r->any('/userprofile')->to( 'CGI#page_cgi' => { 'id' => 'user_profile.html' } ); + $r->any('/request_defer')->to( 'CGI#page_cgi' => { 'id' => 'request_defer.html' } ); + $r->any('/login')->to( 'CGI#index_cgi' => { 'GoAheadAndLogIn' => '1' } ); - $r->any('/:new_bug' => [new_bug => qr{new[-_]bug}])->to( 'CGI#new_bug_cgi'); + $r->any( '/:new_bug' => [ new_bug => qr{new[-_]bug} ] )->to('CGI#new_bug_cgi'); my $ses_auth = $r->under( '/ses' => sub { @@ -85,130 +85,7 @@ sub startup { ); $ses_auth->any('/index.cgi')->to('SES#main'); - $r->any('/:REWRITE_itrequest' => [REWRITE_itrequest => qr{form[\.:]itrequest}])->to( - 'CGI#enter_bug_cgi' => { 'product' => 'Infrastructure & Operations', 'format' => 'itrequest' } - ); - $r->any('/:REWRITE_mozlist' => [REWRITE_mozlist => qr{form[\.:]mozlist}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'mozilla.org', 'format' => 'mozlist'} - ); - $r->any('/:REWRITE_poweredby' => [REWRITE_poweredby => qr{form[\.:]poweredby}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'mozilla.org', 'format' => 'poweredby'} - ); - $r->any('/:REWRITE_presentation' => [REWRITE_presentation => qr{form[\.:]presentation}])->to( - 'cgi#enter_bug_cgi' => {'product' => 'mozilla.org', 'format' => 'presentation'} - ); - $r->any('/:REWRITE_trademark' => [REWRITE_trademark => qr{form[\.:]trademark}])->to( - 'cgi#enter_bug_cgi' => {'product' => 'mozilla.org', 'format' => 'trademark'} - ); - $r->any('/:REWRITE_recoverykey' => [REWRITE_recoverykey => qr{form[\.:]recoverykey}])->to( - 'cgi#enter_bug_cgi' => {'product' => 'mozilla.org', 'format' => 'recoverykey'} - ); - $r->any('/:REWRITE_legal' => [REWRITE_legal => qr{form[\.:]legal}])->to( - 'CGI#enter_bug_cgi' => { 'product' => 'Legal', 'format' => 'legal' }, - ); - $r->any('/:REWRITE_recruiting' => [REWRITE_recruiting => qr{form[\.:]recruiting}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'Recruiting', 'format' => 'recruiting'} - ); - $r->any('/:REWRITE_intern' => [REWRITE_intern => qr{form[\.:]intern}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'Recruiting', 'format' => 'intern'} - ); - $r->any('/:REWRITE_mozpr' => [REWRITE_mozpr => qr{form[\.:]mozpr}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'Mozilla PR', 'format' => 'mozpr' }, - ); - $r->any('/:REWRITE_reps_mentorship' => [REWRITE_reps_mentorship => qr{form[\.:]reps[\.:]mentorship}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'Mozilla Reps','format' => 'mozreps' }, - ); - $r->any('/:REWRITE_reps_budget' => [REWRITE_reps_budget => qr{form[\.:]reps[\.:]budget}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'Mozilla Reps','format' => 'remo-budget'} - ); - $r->any('/:REWRITE_reps_swag' => [REWRITE_reps_swag => qr{form[\.:]reps[\.:]swag}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'Mozilla Reps','format' => 'remo-swag'} - ); - $r->any('/:REWRITE_reps_it' => [REWRITE_reps_it => qr{form[\.:]reps[\.:]it}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'Mozilla Reps','format' => 'remo-it'} - ); - $r->any('/:REWRITE_reps_payment' => [REWRITE_reps_payment => qr{form[\.:]reps[\.:]payment}])->to( - 'CGI#page_cgi' => {'id' => 'remo-form-payment.html'} - ); - $r->any('/:REWRITE_csa_discourse' => [REWRITE_csa_discourse => qr{form[\.:]csa[\.:]discourse}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'Infrastructure & Operations', 'format' => 'csa-discourse'} - ); - $r->any('/:REWRITE_employee_incident' => [REWRITE_employee_incident => qr{form[\.:]employee[\.\-:]incident}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'mozilla.org', 'format' => 'employee-incident'} - ); - $r->any('/:REWRITE_brownbag' => [REWRITE_brownbag => qr{form[\.:]brownbag}])->to( - 'CGI#https_air_mozilla_org_requests' => {} - ); - $r->any('/:REWRITE_finance' => [REWRITE_finance => qr{form[\.:]finance}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'Finance','format' => 'finance'} - ); - $r->any('/:REWRITE_moz_project_review' => [REWRITE_moz_project_review => qr{form[\.:]moz[\.\-:]project[\.\-:]review}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'mozilla.org','format' => 'moz-project-review'} - ); - $r->any('/:REWRITE_docs' => [REWRITE_docs => qr{form[\.:]docs?}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'Developer Documentation','format' => 'doc'} - ); - $r->any('/:REWRITE_mdn' => [REWRITE_mdn => qr{form[\.:]mdn?}])->to( - 'CGI#enter_bug_cgi' => {'format' => 'mdn','product' => 'developer.mozilla.org'} - ); - $r->any('/:REWRITE_swag_gear' => [REWRITE_swag_gear => qr{form[\.:](swag|gear)}])->to( - 'CGI#enter_bug_cgi' => {'format' => 'swag','product' => 'Marketing'} - ); - $r->any('/:REWRITE_costume' => [REWRITE_costume => qr{form[\.:]costume}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'Marketing','format' => 'costume'} - ); - $r->any('/:REWRITE_ipp' => [REWRITE_ipp => qr{form[\.:]ipp}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'Internet Public Policy','format' => 'ipp'} - ); - $r->any('/:REWRITE_creative' => [REWRITE_creative => qr{form[\.:]creative}])->to( - 'CGI#enter_bug_cgi' => {'format' => 'creative','product' => 'Marketing'} - ); - $r->any('/:REWRITE_user_engagement' => [REWRITE_user_engagement => qr{form[\.:]user[\.\-:]engagement}])->to( - 'CGI#enter_bug_cgi' => {'format' => 'user-engagement','product' => 'Marketing'} - ); - $r->any('/:REWRITE_dev_engagement_event' => [REWRITE_dev_engagement_event => qr{form[\.:]dev[\.\-:]engagement[\.\-\:]event}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'Developer Engagement','format' => 'dev-engagement-event'} - ); - $r->any('/:REWRITE_mobile_compat' => [REWRITE_mobile_compat => qr{form[\.:]mobile[\.\-:]compat}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'Tech Evangelism','format' => 'mobile-compat'} - ); - $r->any('/:REWRITE_web_bounty' => [REWRITE_web_bounty => qr{form[\.:]web[\.:]bounty}])->to( - 'CGI#enter_bug_cgi' => {'format' => 'web-bounty','product' => 'mozilla.org'} - ); - $r->any('/:REWRITE_automative' => [REWRITE_automative => qr{form[\.:]automative}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'Testing','format' => 'automative'} - ); - $r->any('/:REWRITE_comm_newsletter' => [REWRITE_comm_newsletter => qr{form[\.:]comm[\.:]newsletter}])->to( - 'CGI#enter_bug_cgi' => {'format' => 'comm-newsletter','product' => 'Marketing'} - ); - $r->any('/:REWRITE_screen_share_whitelist' => [REWRITE_screen_share_whitelist => qr{form[\.:]screen[\.:]share[\.:]whitelist}])->to( - 'CGI#enter_bug_cgi' => {'format' => 'screen-share-whitelist','product' => 'Firefox'} - ); - $r->any('/:REWRITE_data_compliance' => [REWRITE_data_compliance => qr{form[\.:]data[\.\-:]compliance}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'Data Compliance','format' => 'data-compliance'} - ); - $r->any('/:REWRITE_fsa_budget' => [REWRITE_fsa_budget => qr{form[\.:]fsa[\.:]budget}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'FSA','format' => 'fsa-budget'} - ); - $r->any('/:REWRITE_triage_request' => [REWRITE_triage_request => qr{form[\.:]triage[\.\-]request}])->to( - 'CGI#page_cgi' => {'id' => 'triage_request.html'} - ); - $r->any('/:REWRITE_crm_CRM' => [REWRITE_crm_CRM => qr{form[\.:](crm|CRM)}])->to( - 'CGI#enter_bug_cgi' => {'format' => 'crm','product' => 'Marketing'} - ); - $r->any('/:REWRITE_nda' => [REWRITE_nda => qr{form[\.:]nda}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'Legal','format' => 'nda'} - ); - $r->any('/:REWRITE_name_clearance' => [REWRITE_name_clearance => qr{form[\.:]name[\.:]clearance}])->to( - 'CGI#enter_bug_cgi' => {'format' => 'name-clearance','product' => 'Legal'} - ); - $r->any('/:REWRITE_shield_studies' => [REWRITE_shield_studies => qr{form[\.:]shield[\.:]studies}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'Shield','format' => 'shield-studies'} - ); - $r->any('/:REWRITE_client_bounty' => [REWRITE_client_bounty => qr{form[\.:]client[\.:]bounty}])->to( - 'CGI#enter_bug_cgi' => {'product' => 'Firefox','format' => 'client-bounty'} - ); - + Bugzilla::Hook::process( 'app_startup', { app => $self } ); } 1; |