From: mkanat%bugzilla.org <> Date: Tue, 16 Dec 2008 21:16:25 +0000 (+0000) Subject: Bug 467701: USAGE_MODE_CMDLINE should be the default if not i_am_cgi() X-Git-Tag: bugzilla-3.3.1~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bfa4c5aede92951fa43d3bee1b15b9773e3d20f2;p=thirdparty%2Fbugzilla.git Bug 467701: USAGE_MODE_CMDLINE should be the default if not i_am_cgi() Patch By Max Kanat-Alexander r=LpSolit, a=LpSolit --- diff --git a/Bugzilla.pm b/Bugzilla.pm index e80f184ed4..354d051481 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 d7a787f488..74b21dfdac 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 08f1c11316..761c648c82 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 eade756832..b4f1fffd2a 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 d2ff9cc675..fd8c27723d 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 2ef0eea7da..e0128b58a0 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');