diff options
author | lpsolit%gmail.com <> | 2006-12-09 20:51:33 +0100 |
---|---|---|
committer | lpsolit%gmail.com <> | 2006-12-09 20:51:33 +0100 |
commit | accd734fd5a4ac2d242997c110c1924844219ba7 (patch) | |
tree | 2f82a2be166e2aea8bf75cc6aaa17374f0d9534a /Bugzilla | |
parent | 850da7d0ea8233e343d31f159a9f21c18b0f1390 (diff) | |
download | bugzilla-accd734fd5a4ac2d242997c110c1924844219ba7.tar.gz bugzilla-accd734fd5a4ac2d242997c110c1924844219ba7.tar.xz |
Bug 361252: checksetup.pl should get confirmation from the user before causing dataloss in UTF8 conversion - Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit a=myk
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Config.pm | 2 | ||||
-rw-r--r-- | Bugzilla/Constants.pm | 7 | ||||
-rw-r--r-- | Bugzilla/DB/Mysql.pm | 21 | ||||
-rw-r--r-- | Bugzilla/Install.pm | 2 | ||||
-rw-r--r-- | Bugzilla/Install/Localconfig.pm | 6 |
5 files changed, 30 insertions, 8 deletions
diff --git a/Bugzilla/Config.pm b/Bugzilla/Config.pm index 0859c5bee..85c9d6dec 100644 --- a/Bugzilla/Config.pm +++ b/Bugzilla/Config.pm @@ -100,7 +100,7 @@ sub SetParam { sub update_params { my ($params) = @_; - my $answer = $params->{answer} || {}; + my $answer = Bugzilla->installation_answers; my $param = read_param_file(); diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm index 89032c0b0..1b774c64c 100644 --- a/Bugzilla/Constants.pm +++ b/Bugzilla/Constants.pm @@ -127,6 +127,9 @@ use File::Basename; ERROR_MODE_DIE ERROR_MODE_DIE_SOAP_FAULT + INSTALLATION_MODE_INTERACTIVE + INSTALLATION_MODE_NON_INTERACTIVE + DB_MODULE ROOT_USER ON_WINDOWS @@ -349,6 +352,10 @@ use constant ERROR_MODE_WEBPAGE => 0; use constant ERROR_MODE_DIE => 1; use constant ERROR_MODE_DIE_SOAP_FAULT => 2; +# The various modes that checksetup.pl can run in. +use constant INSTALLATION_MODE_INTERACTIVE => 0; +use constant INSTALLATION_MODE_NON_INTERACTIVE => 1; + # Data about what we require for different databases. use constant DB_MODULE => { 'mysql' => {db => 'Bugzilla::DB::Mysql', db_version => '4.1.2', diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm index 4335a1b2f..a8210a972 100644 --- a/Bugzilla/DB/Mysql.pm +++ b/Bugzilla/DB/Mysql.pm @@ -43,6 +43,7 @@ package Bugzilla::DB::Mysql; use strict; +use Bugzilla::Constants; use Bugzilla::Util; use Bugzilla::Error; @@ -349,7 +350,7 @@ sub bz_setup_database { . "If you would like to cancel, press Ctrl-C now..." . " (Waiting 45 seconds...)\n\n"; # Wait 45 seconds for them to respond. - sleep(45); + sleep(45) unless Bugzilla->installation_answers->{NO_PAUSE}; } print "Renaming indexes...\n"; @@ -566,9 +567,23 @@ WARNING: We are about to convert your table storage format to UTF8. This If you ever used a version of Bugzilla before 2.22, we STRONGLY recommend that you stop checksetup.pl NOW and run contrib/recode.pl. - Continuing in 60 seconds... EOT - sleep 60; + + if (!Bugzilla->installation_answers->{NO_PAUSE}) { + if (Bugzilla->installation_mode == + INSTALLATION_MODE_NON_INTERACTIVE) + { + print <<EOT; + Re-run checksetup.pl in interactive mode (without an 'answers' file) + to continue. +EOT + exit; + } + else { + print " Press Enter to continue or Ctrl-C to exit..."; + getc; + } + } print "Converting table storage format to UTF-8. This may take a", " while.\n"; diff --git a/Bugzilla/Install.pm b/Bugzilla/Install.pm index 18f7473ae..c31bb58df 100644 --- a/Bugzilla/Install.pm +++ b/Bugzilla/Install.pm @@ -274,7 +274,7 @@ sub create_admin { return if $admin_count; - my %answer = %{$params->{answer} || {}}; + my %answer = %{Bugzilla->installation_answers}; my $login = $answer{'ADMIN_EMAIL'}; my $password = $answer{'ADMIN_PASSWORD'}; my $full_name = $answer{'ADMIN_REALNAME'}; diff --git a/Bugzilla/Install/Localconfig.pm b/Bugzilla/Install/Localconfig.pm index 9cc8c49cc..ed502d8a7 100644 --- a/Bugzilla/Install/Localconfig.pm +++ b/Bugzilla/Install/Localconfig.pm @@ -275,7 +275,7 @@ sub update_localconfig { my ($params) = @_; my $output = $params->{output} || 0; - my $answer = $params->{answer} || {}; + my $answer = Bugzilla->installation_answers; my $localconfig = read_localconfig('include deprecated'); my @new_vars; @@ -401,7 +401,7 @@ Bugzilla::Install::Localconfig - Functions and variables dealing =head1 SYNOPSIS use Bugzilla::Install::Requirements qw(update_localconfig); - update_localconfig({ output => 1, answer => \%answer }); + update_localconfig({ output => 1 }); =head1 DESCRIPTION @@ -453,7 +453,7 @@ Returns: A hashref of the localconfig variables. If an array (and C<OLD_LOCALCONFIG_VARS> if C<$include_deprecated> is specified). -=item C<update_localconfig({ output =E<gt> 1, answer =E<gt> \%answer })> +=item C<update_localconfig({ output =E<gt> 1 })> Description: Adds any new variables to localconfig that aren't currently defined there. Also optionally prints out |