Commit bfa4c5ae authored by mkanat%bugzilla.org's avatar mkanat%bugzilla.org

Bug 467701: USAGE_MODE_CMDLINE should be the default if not i_am_cgi()

Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
parent 82262256
...@@ -372,7 +372,7 @@ sub usage_mode { ...@@ -372,7 +372,7 @@ sub usage_mode {
$class->request_cache->{usage_mode} = $newval; $class->request_cache->{usage_mode} = $newval;
} }
return $class->request_cache->{usage_mode} return $class->request_cache->{usage_mode}
|| Bugzilla::Constants::USAGE_MODE_BROWSER; || (i_am_cgi()? USAGE_MODE_BROWSER : USAGE_MODE_CMDLINE);
} }
sub installation_mode { sub installation_mode {
......
...@@ -115,7 +115,6 @@ require Bugzilla::Template; ...@@ -115,7 +115,6 @@ require Bugzilla::Template;
require Bugzilla::Field; require Bugzilla::Field;
require Bugzilla::Install; require Bugzilla::Install;
Bugzilla->usage_mode(USAGE_MODE_CMDLINE);
Bugzilla->installation_mode(INSTALLATION_MODE_NON_INTERACTIVE) if $answers_file; Bugzilla->installation_mode(INSTALLATION_MODE_NON_INTERACTIVE) if $answers_file;
Bugzilla->installation_answers($answers_file); Bugzilla->installation_answers($answers_file);
......
...@@ -59,9 +59,6 @@ if (chdir("graphs")) { ...@@ -59,9 +59,6 @@ if (chdir("graphs")) {
chdir($cwd); chdir($cwd);
} }
# This is a pure command line script.
Bugzilla->usage_mode(USAGE_MODE_CMDLINE);
my $dbh = Bugzilla->switch_to_shadow_db(); my $dbh = Bugzilla->switch_to_shadow_db();
......
...@@ -48,8 +48,6 @@ use constant TARGET_DB_HOST => 'localhost'; ...@@ -48,8 +48,6 @@ use constant TARGET_DB_HOST => 'localhost';
# MAIN SCRIPT # MAIN SCRIPT
##################################################################### #####################################################################
Bugzilla->usage_mode(USAGE_MODE_CMDLINE);
print "Connecting to the '" . SOURCE_DB_NAME . "' source database on " print "Connecting to the '" . SOURCE_DB_NAME . "' source database on "
. SOURCE_DB_TYPE . "...\n"; . SOURCE_DB_TYPE . "...\n";
my $source_db = Bugzilla::DB::_connect(SOURCE_DB_TYPE, SOURCE_DB_HOST, my $source_db = Bugzilla::DB::_connect(SOURCE_DB_TYPE, SOURCE_DB_HOST,
......
...@@ -92,10 +92,6 @@ use Getopt::Long; ...@@ -92,10 +92,6 @@ use Getopt::Long;
use Pod::Usage; use Pod::Usage;
use XML::Twig; 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 $debug = 0;
my $mail = ''; my $mail = '';
my $attach_path = ''; my $attach_path = '';
......
...@@ -42,8 +42,6 @@ my $result = GetOptions('verbose' => \$verbose, ...@@ -42,8 +42,6 @@ my $result = GetOptions('verbose' => \$verbose,
pod2usage({-verbose => 1, -exitval => 1}) if $help; pod2usage({-verbose => 1, -exitval => 1}) if $help;
Bugzilla->usage_mode(USAGE_MODE_CMDLINE);
# Be sure a login name if given. # Be sure a login name if given.
$login || ThrowUserError('invalid_username'); $login || ThrowUserError('invalid_username');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment