From bfa4c5aede92951fa43d3bee1b15b9773e3d20f2 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Tue, 16 Dec 2008 21:16:25 +0000 Subject: Bug 467701: USAGE_MODE_CMDLINE should be the default if not i_am_cgi() Patch By Max Kanat-Alexander r=LpSolit, a=LpSolit --- Bugzilla.pm | 2 +- checksetup.pl | 1 - collectstats.pl | 3 --- contrib/bzdbcopy.pl | 2 -- importxml.pl | 4 ---- sanitycheck.pl | 2 -- 6 files changed, 1 insertion(+), 13 deletions(-) diff --git a/Bugzilla.pm b/Bugzilla.pm index e80f184ed..354d05148 100644 --- a/Bugzilla.pm +++ b/Bugzilla.pm @@ -372,7 +372,7 @@ sub usage_mode { $class->request_cache->{usage_mode} = $newval; } return $class->request_cache->{usage_mode} - || Bugzilla::Constants::USAGE_MODE_BROWSER; + || (i_am_cgi()? USAGE_MODE_BROWSER : USAGE_MODE_CMDLINE); } sub installation_mode { diff --git a/checksetup.pl b/checksetup.pl index d7a787f48..74b21dfda 100755 --- a/checksetup.pl +++ b/checksetup.pl @@ -115,7 +115,6 @@ require Bugzilla::Template; require Bugzilla::Field; require Bugzilla::Install; -Bugzilla->usage_mode(USAGE_MODE_CMDLINE); Bugzilla->installation_mode(INSTALLATION_MODE_NON_INTERACTIVE) if $answers_file; Bugzilla->installation_answers($answers_file); diff --git a/collectstats.pl b/collectstats.pl index 08f1c1131..761c648c8 100755 --- a/collectstats.pl +++ b/collectstats.pl @@ -59,9 +59,6 @@ if (chdir("graphs")) { chdir($cwd); } -# This is a pure command line script. -Bugzilla->usage_mode(USAGE_MODE_CMDLINE); - my $dbh = Bugzilla->switch_to_shadow_db(); diff --git a/contrib/bzdbcopy.pl b/contrib/bzdbcopy.pl index eade75683..b4f1fffd2 100755 --- a/contrib/bzdbcopy.pl +++ b/contrib/bzdbcopy.pl @@ -48,8 +48,6 @@ use constant TARGET_DB_HOST => 'localhost'; # MAIN SCRIPT ##################################################################### -Bugzilla->usage_mode(USAGE_MODE_CMDLINE); - print "Connecting to the '" . SOURCE_DB_NAME . "' source database on " . SOURCE_DB_TYPE . "...\n"; my $source_db = Bugzilla::DB::_connect(SOURCE_DB_TYPE, SOURCE_DB_HOST, diff --git a/importxml.pl b/importxml.pl index d2ff9cc67..fd8c27723 100755 --- a/importxml.pl +++ b/importxml.pl @@ -92,10 +92,6 @@ use Getopt::Long; use Pod::Usage; use XML::Twig; -# We want to capture errors and handle them here rather than have the Template -# code barf all over the place. -Bugzilla->usage_mode(Bugzilla::Constants::USAGE_MODE_CMDLINE); - my $debug = 0; my $mail = ''; my $attach_path = ''; diff --git a/sanitycheck.pl b/sanitycheck.pl index 2ef0eea7d..e0128b58a 100644 --- a/sanitycheck.pl +++ b/sanitycheck.pl @@ -42,8 +42,6 @@ my $result = GetOptions('verbose' => \$verbose, pod2usage({-verbose => 1, -exitval => 1}) if $help; -Bugzilla->usage_mode(USAGE_MODE_CMDLINE); - # Be sure a login name if given. $login || ThrowUserError('invalid_username'); -- cgit v1.2.3-24-g4f1b