#####################################################################
# Note that this is a raw subroutine, not a method, so $class isn't available.
+# Called prior to every Bugzilla CGI request (not called for native Mojo
+# routes).
sub init_page {
-
- # This is probably not needed, but bugs resulting from a dirty
- # request cache are very annoying (see bug 1347335)
- # and this is not an expensive operation.
- clear_request_cache();
if (Bugzilla->usage_mode == USAGE_MODE_CMDLINE) {
init_console();
}
}
);
}
+ $self->hook(
+ before_dispatch => sub {
+ # Ensure the request_cache is always cleared prior to every request,
+ # regardless of routing or Bugzilla::App wrapping.
+ # This is not an expensive operation.
+ Bugzilla->clear_request_cache();
+ # We also need to clear CGI's globals.
+ CGI::initialize_globals();
+ }
+ );
$self->hook(after_dispatch => sub {
my ($c) = @_;
my ($req, $res) = ($c->req, $c->res);
$c->stash->{cleanup_guard}->dismiss;
Bugzilla->usage_mode(USAGE_MODE_BROWSER);
try {
- CGI::initialize_globals();
Bugzilla->init_page();
$inner->();
}