summaryrefslogtreecommitdiffstats
path: root/Bugzilla.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla.pm')
-rw-r--r--Bugzilla.pm30
1 files changed, 16 insertions, 14 deletions
diff --git a/Bugzilla.pm b/Bugzilla.pm
index 8bcef7b28..2f21c6a18 100644
--- a/Bugzilla.pm
+++ b/Bugzilla.pm
@@ -62,17 +62,17 @@ use Safe;
#####################################################################
# Scripts that are not stopped by shutdownhtml being in effect.
-use constant SHUTDOWNHTML_EXEMPT => [
- 'editparams.cgi',
- 'checksetup.pl',
- 'migrate.pl',
- 'recode.pl',
-];
+use constant SHUTDOWNHTML_EXEMPT => qw(
+ editparams.cgi
+ checksetup.pl
+ migrate.pl
+ recode.pl
+);
# Non-cgi scripts that should silently exit.
-use constant SHUTDOWNHTML_EXIT_SILENTLY => [
- 'whine.pl'
-];
+use constant SHUTDOWNHTML_EXIT_SILENTLY => qw(
+ whine.pl
+);
#####################################################################
# Global Code
@@ -112,8 +112,10 @@ sub init_page {
};
}
+ my $script = basename($0);
+
# Because of attachment_base, attachment.cgi handles this itself.
- if (basename($0) ne 'attachment.cgi') {
+ if ($script ne 'attachment.cgi') {
do_ssl_redirect_if_required();
}
@@ -123,14 +125,14 @@ sub init_page {
#
# This code must go here. It cannot go anywhere in Bugzilla::CGI, because
# it uses Template, and that causes various dependency loops.
- if (Bugzilla->params->{"shutdownhtml"}
- && lsearch(SHUTDOWNHTML_EXEMPT, basename($0)) == -1)
+ if (Bugzilla->params->{"shutdownhtml"}
+ && !grep { $_ eq $script } SHUTDOWNHTML_EXEMPT)
{
# Allow non-cgi scripts to exit silently (without displaying any
# message), if desired. At this point, no DBI call has been made
# yet, and no error will be returned if the DB is inaccessible.
- if (lsearch(SHUTDOWNHTML_EXIT_SILENTLY, basename($0)) > -1
- && !i_am_cgi())
+ if (!i_am_cgi()
+ && grep { $_ eq $script } SHUTDOWNHTML_EXIT_SILENTLY)
{
exit;
}