aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-04-22 11:02:17 -0700
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-04-22 11:02:17 -0700
commit271477d8c26794abd8310e2abb89b746204660af (patch)
treea4701a52f9ff1918e25a75e09267bfba0b063296 /Bugzilla.pm
parentThe maintainer of MIME::tools released a new version that now supports (diff)
downloadbugzilla-271477d8c26794abd8310e2abb89b746204660af.tar.gz
bugzilla-271477d8c26794abd8310e2abb89b746204660af.tar.bz2
bugzilla-271477d8c26794abd8310e2abb89b746204660af.zip
Bug 560009: Use firstidx from List::MoreUtils instead of lsearch
r=timello, a=mkanat
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;
}