summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-08-11 12:20:30 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-08-11 12:20:30 +0200
commit6715b4dbad317ac79ff55c3c761cf6af58651a26 (patch)
tree0cb8529400a2c9feb8590749fbdf6a2b693c8582 /Bugzilla
parentaec17c9f7769c22173d9d722250628a6aa3ffd2a (diff)
downloadbugzilla-6715b4dbad317ac79ff55c3c761cf6af58651a26.tar.gz
bugzilla-6715b4dbad317ac79ff55c3c761cf6af58651a26.tar.xz
Bug 586210: Make every important string printed by checksetup.pl localizable,
including the localconfig parameter descriptions r=mkanat, a=mkanat (module owner)
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/DB/Mysql.pm54
-rw-r--r--Bugzilla/Install/CPAN.pm2
-rw-r--r--Bugzilla/Install/DB.pm43
-rw-r--r--Bugzilla/Install/Localconfig.pm176
-rw-r--r--Bugzilla/Install/Requirements.pm17
5 files changed, 53 insertions, 239 deletions
diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm
index 699fcfdf6..1829bc450 100644
--- a/Bugzilla/DB/Mysql.pm
+++ b/Bugzilla/DB/Mysql.pm
@@ -316,12 +316,7 @@ sub bz_setup_database {
my ($innodb_on) = @{$self->selectcol_arrayref(
q{SHOW VARIABLES LIKE '%have_innodb%'}, {Columns=>[2]})};
if ($innodb_on ne 'YES') {
- die <<EOT;
-InnoDB is disabled in your MySQL installation.
-Bugzilla requires InnoDB to be enabled.
-Please enable it and then re-run checksetup.pl.
-
-EOT
+ die install_string('mysql_innodb_disabled');
}
@@ -423,17 +418,7 @@ EOT
# We just do the check here since this check is a reliable way
# of telling that we are upgrading from a version pre-2.20.
if (grep($_ eq 'bz_schema', $self->bz_table_list_real())) {
- die("\nYou are upgrading from a version before 2.20, but the"
- . " bz_schema\ntable already exists. This means that you"
- . " restored a mysqldump into\nthe Bugzilla database without"
- . " first dropping the already-existing\nBugzilla database,"
- . " at some point. Whenever you restore a Bugzilla\ndatabase"
- . " backup, you must always drop the entire database first.\n\n"
- . "Please drop your Bugzilla database and restore it from a"
- . " backup that\ndoes not contain the bz_schema table. If for"
- . " some reason you cannot\ndo this, you can connect to your"
- . " MySQL database and drop the bz_schema\ntable, as a last"
- . " resort.\n");
+ die install_string('bz_schema_exists_before_220');
}
my $bug_count = $self->selectrow_array("SELECT COUNT(*) FROM bugs");
@@ -447,12 +432,8 @@ EOT
# If we're going to take longer than 5 minutes, we let the user know
# and allow them to abort.
if ($rename_time > 5) {
- print "\nWe are about to rename old indexes.\n"
- . "The estimated time to complete renaming is "
- . "$rename_time minutes.\n"
- . "You cannot interrupt this action once it has begun.\n"
- . "If you would like to cancel, press Ctrl-C now..."
- . " (Waiting 45 seconds...)\n\n";
+ print "\n", install_string('mysql_index_renaming',
+ { minutes => $rename_time });
# Wait 45 seconds for them to respond.
sleep(45) unless Bugzilla->installation_answers->{NO_PAUSE};
}
@@ -685,36 +666,16 @@ EOT
my @non_utf8_tables = grep(defined($_->{Collation}) && $_->{Collation} !~ /^utf8/, @$utf_table_status);
if (Bugzilla->params->{'utf8'} && scalar @non_utf8_tables) {
- print <<EOT;
-
-WARNING: We are about to convert your table storage format to UTF8. This
- allows Bugzilla to correctly store and sort international characters.
- However, if you have any non-UTF-8 data in your database,
- it ***WILL BE DELETED*** by this process. So, before
- you continue with checksetup.pl, if you have any non-UTF-8
- data (or even if you're not sure) you should press Ctrl-C now
- to interrupt checksetup.pl, and run contrib/recode.pl to make all
- the data in your database into UTF-8. You should also back up your
- database before continuing. This will affect every single table
- in the database, even non-Bugzilla tables.
-
- 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.
-
-EOT
+ print "\n", install_string('mysql_utf8_conversion');
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;
+ die install_string('continue_without_answers'), "\n";
}
else {
- print " Press Enter to continue or Ctrl-C to exit...";
+ print "\n " . install_string('enter_or_ctrl_c');
getc;
}
}
@@ -1088,4 +1049,5 @@ sub _bz_build_schema_from_disk {
return $schema;
}
+
1;
diff --git a/Bugzilla/Install/CPAN.pm b/Bugzilla/Install/CPAN.pm
index 1d57b08f3..0ef003d69 100644
--- a/Bugzilla/Install/CPAN.pm
+++ b/Bugzilla/Install/CPAN.pm
@@ -191,7 +191,7 @@ sub set_cpan_config {
# If we can't make one, we finally try to use the Bugzilla directory.
if (!-w $dir) {
- print "WARNING: Using the Bugzilla directory as the CPAN home.\n";
+ print STDERR install_string('cpan_bugzilla_home'), "\n";
$dir = "$bzlib/.cpan";
}
}
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm
index 33f37208f..01270aab6 100644
--- a/Bugzilla/Install/DB.pm
+++ b/Bugzilla/Install/DB.pm
@@ -1279,15 +1279,7 @@ sub _move_quips_into_db {
$dbh->do("INSERT INTO quips (quip) VALUES (?)", undef, $_);
}
- print <<EOT;
-
-Quips are now stored in the database, rather than in an external file.
-The quips previously stored in $datadir/comments have been copied into
-the database, and that file has been renamed to $datadir/comments.bak
-You may delete the renamed file once you have confirmed that all your
-quips were moved successfully.
-
-EOT
+ print "\n", install_string('update_quips', { data => $datadir }), "\n";
$comments->close;
rename("$datadir/comments", "$datadir/comments.bak")
|| warn "Failed to rename: $!";
@@ -1861,9 +1853,9 @@ sub _remove_spaces_and_commas_from_flagtypes {
if (length($tryflagname) > 50) {
my $lastchanceflagname = (substr $tryflagname, 0, 47) . '...';
if (defined($flagtypes{$lastchanceflagname})) {
- print " ... last attempt as \"$lastchanceflagname\" still failed.'\n",
- "Rename the flag by hand and run checksetup.pl again.\n";
- die("Bad flag type name $flagname");
+ print " ... last attempt as \"$lastchanceflagname\" still failed.'\n";
+ die install_string('update_flags_bad_name',
+ { flag => $flagname }), "\n";
}
$tryflagname = $lastchanceflagname;
}
@@ -2747,12 +2739,7 @@ sub _change_short_desc_from_mediumtext_to_varchar {
FROM bugs WHERE CHAR_LENGTH(short_desc) > 255');
if (@$long_summary_bugs) {
- print <<EOT;
-
-WARNING: Some of your bugs had summaries longer than 255 characters.
-They have had their original summary copied into a comment, and then
-the summary was truncated to 255 characters. The affected bug numbers were:
-EOT
+ print "\n", install_string('update_summary_truncated');
my $comment_sth = $dbh->prepare(
'INSERT INTO longdescs (bug_id, who, thetext, bug_when)
VALUES (?, ?, ?, NOW())');
@@ -2761,10 +2748,9 @@ EOT
my @affected_bugs;
foreach my $bug (@$long_summary_bugs) {
my ($bug_id, $summary, $reporter_id) = @$bug;
- my $summary_comment = "The original summary for this bug"
- . " was longer than 255 characters, and so it was truncated"
- . " when Bugzilla was upgraded. The original summary was:"
- . "\n\n$summary";
+ my $summary_comment =
+ install_string('update_summary_truncate_comment',
+ { summary => $summary });
$comment_sth->execute($bug_id, $reporter_id, $summary_comment);
my $short_summary = substr($summary, 0, 252) . "...";
$desc_sth->execute($short_summary, $bug_id);
@@ -2849,12 +2835,8 @@ sub _move_data_nomail_into_db {
# If there are any nomail entries remaining, move them to nomail.bad
# and say something to the user.
if (scalar(keys %nomail)) {
- print <<EOT;
-
-WARNING: The following users were listed in data/nomail, but do not
-have an account here. The unmatched entries have been moved
-to $datadir/nomail.bad:
-EOT
+ print "\n", install_string('update_nomail_bad',
+ { data => $datadir }), "\n";
my $nomail_bad = new IO::File("$datadir/nomail.bad", '>>');
foreach my $unknown_user (keys %nomail) {
print "\t$unknown_user\n";
@@ -3281,9 +3263,10 @@ sub _fix_invalid_custom_field_names {
next if $field->name =~ /^[a-zA-Z0-9_]+$/;
# The field name is illegal and can break the DB. Kill the field!
$field->set_obsolete(1);
- print "Removing custom field '" . $field->name . "' (illegal name)... ";
+ print install_string('update_cf_invalid_name',
+ { field => $field->name }), "\n";
eval { $field->remove_from_db(); };
- print $@ ? "failed:\n$@\n" : "succeeded\n";
+ warn $@ if $@;
}
}
diff --git a/Bugzilla/Install/Localconfig.pm b/Bugzilla/Install/Localconfig.pm
index d5d76cb79..956d3c72e 100644
--- a/Bugzilla/Install/Localconfig.pm
+++ b/Bugzilla/Install/Localconfig.pm
@@ -31,7 +31,7 @@ package Bugzilla::Install::Localconfig;
use strict;
use Bugzilla::Constants;
-use Bugzilla::Install::Util qw(bin_loc);
+use Bugzilla::Install::Util qw(bin_loc install_string);
use Bugzilla::Util qw(generate_random_password);
use Data::Dumper;
@@ -50,169 +50,66 @@ use constant LOCALCONFIG_VARS => (
{
name => 'create_htaccess',
default => 1,
- desc => <<EOT
-# If you are using Apache as your web server, Bugzilla can create .htaccess
-# files for you that will instruct Apache not to serve files that shouldn't
-# be accessed from the web browser (like your local configuration data and non-cgi
-# executable files). For this to work, the directory your Bugzilla
-# installation is in must be within the jurisdiction of a <Directory> block
-# in the httpd.conf file that has 'AllowOverride Limit' in it. If it has
-# 'AllowOverride All' or other options with Limit, that's fine.
-# (Older Apache installations may use an access.conf file to store these
-# <Directory> blocks.)
-# If this is set to 1, Bugzilla will create these files if they don't exist.
-# If this is set to 0, Bugzilla will not create these files.
-EOT
},
{
name => 'webservergroup',
default => ON_WINDOWS ? '' : 'apache',
- desc => q{# Usually, this is the group your web server runs as.
-# If you have a Windows box, ignore this setting.
-# If you have use_suexec switched on below, this is the group Apache switches
-# to in order to run Bugzilla scripts.
-# If you do not have access to the group your scripts will run under,
-# set this to "". If you do set this to "", then your Bugzilla installation
-# will be _VERY_ insecure, because some files will be world readable/writable,
-# and so anyone who can get local access to your machine can do whatever they
-# want. You should only have this set to "" if this is a testing installation
-# and you cannot set this up any other way. YOU HAVE BEEN WARNED!
-# If you set this to anything other than "", you will need to run checksetup.pl
-# as} . ROOT_USER . qq{, or as a user who is a member of the specified group.\n}
},
{
name => 'use_suexec',
default => 0,
- desc => <<EOT
-# Set this if Bugzilla runs in an Apache SuexecUserGroup environment.
-# (If your web server runs control panel software (cPanel, Plesk or similar),
-# or if your Bugzilla is to run in a shared hosting environment, then you are
-# almost certainly in an Apache SuexecUserGroup environment.)
-# If you have a Windows box, ignore this setting.
-# If set to 0, Bugzilla will set file permissions as tightly as possible.
-# If set to 1, Bugzilla will set file permissions so that it may work in an
-# SuexecUserGroup environment. The difference is that static files (CSS,
-# JavaScript and so on) will receive world read permissions.
-EOT
},
{
name => 'db_driver',
default => 'mysql',
- desc => <<EOT
-# What SQL database to use. Default is mysql. List of supported databases
-# can be obtained by listing Bugzilla/DB directory - every module corresponds
-# to one supported database and the name corresponds to a driver name.
-EOT
},
{
name => 'db_host',
- default => 'localhost',
- desc =>
- "# The DNS name of the host that the database server runs on.\n"
+ default => 'localhost',
},
{
name => 'db_name',
default => 'bugs',
- desc => "# The name of the database\n"
},
{
name => 'db_user',
default => 'bugs',
- desc => "# Who we connect to the database as.\n"
},
{
name => 'db_pass',
default => '',
- desc => <<EOT
-# Enter your database password here. It's normally advisable to specify
-# a password for your bugzilla database user.
-# If you use apostrophe (') or a backslash (\\) in your password, you'll
-# need to escape it by preceding it with a '\\' character. (\\') or (\\)
-# (Far simpler just not to use those characters.)
-EOT
},
{
name => 'db_port',
default => 0,
- desc => <<EOT
-# Sometimes the database server is running on a non-standard port. If that's
-# the case for your database server, set this to the port number that your
-# database server is running on. Setting this to 0 means "use the default
-# port for my database server."
-EOT
},
{
name => 'db_sock',
default => '',
- desc => <<EOT
-# MySQL Only: Enter a path to the unix socket for MySQL. If this is
-# blank, then MySQL's compiled-in default will be used. You probably
-# want that.
-EOT
},
{
name => 'db_check',
default => 1,
- desc => <<EOT
-# Should checksetup.pl try to verify that your database setup is correct?
-# (with some combinations of database servers/Perl modules/moonphase this
-# doesn't work)
-EOT
},
{
name => 'index_html',
default => 0,
- desc => <<EOT
-# With the introduction of a configurable index page using the
-# template toolkit, Bugzilla's main index page is now index.cgi.
-# Most web servers will allow you to use index.cgi as a directory
-# index, and many come preconfigured that way, but if yours doesn't
-# then you'll need an index.html file that provides redirection
-# to index.cgi. Setting \$index_html to 1 below will allow
-# checksetup.pl to create one for you if it doesn't exist.
-# NOTE: checksetup.pl will not replace an existing file, so if you
-# wish to have checksetup.pl create one for you, you must
-# make sure that index.html doesn't already exist
-EOT
},
{
name => 'cvsbin',
- default => \&_get_default_cvsbin,
- desc => <<EOT
-# For some optional functions of Bugzilla (such as the pretty-print patch
-# viewer), we need the cvs binary to access files and revisions.
-# Because it's possible that this program is not in your path, you can specify
-# its location here. Please specify the full path to the executable.
-EOT
+ default => sub { bin_loc('cvs') },
},
{
name => 'interdiffbin',
- default => \&_get_default_interdiffbin,
- desc => <<EOT
-# For some optional functions of Bugzilla (such as the pretty-print patch
-# viewer), we need the interdiff binary to make diffs between two patches.
-# Because it's possible that this program is not in your path, you can specify
-# its location here. Please specify the full path to the executable.
-EOT
+ default => sub { bin_loc('interdiff') },
},
{
name => 'diffpath',
- default => \&_get_default_diffpath,
- desc => <<EOT
-# The interdiff feature needs diff, so we have to have that path.
-# Please specify the directory name only; do not use trailing slash.
-EOT
+ default => sub { dirname(bin_loc('diff')) },
},
{
name => 'site_wide_secret',
default => sub { generate_random_password(256) },
- desc => <<EOT
-# This secret key is used by your installation for the creation and
-# validation of encrypted tokens to prevent unsolicited changes,
-# such as bug changes. A random string is generated by default.
-# It's very important that this key is kept secret. It also must be
-# very long.
-EOT
},
);
@@ -229,18 +126,8 @@ sub read_localconfig {
$s->rdo($filename);
if ($@ || $!) {
my $err_msg = $@ ? $@ : $!;
- die <<EOT;
-An error has occurred while reading your 'localconfig' file. The text of
-the error message is:
-
-$err_msg
-
-Please fix the error in your 'localconfig' file. Alternately, rename your
-'localconfig' file, rerun checksetup.pl, and re-enter your answers.
-
- \$ mv -f localconfig localconfig.old
- \$ ./checksetup.pl
-EOT
+ die install_string('error_localconfig_read',
+ { error => $err_msg, localconfig => $filename }), "\n";
}
my @read_symbols;
@@ -336,15 +223,7 @@ sub update_localconfig {
}
if (!$localconfig->{'interdiffbin'} && $output) {
- print <<EOT
-
-OPTIONAL NOTE: If you want to be able to use the 'difference between two
-patches' feature of Bugzilla (which requires the PatchReader Perl module
-as well), you should install patchutils from:
-
- http://cyberelk.net/tim/patchutils/
-
-EOT
+ print "\n", install_string('patchutils_missing'), "\n";
}
my @old_vars;
@@ -365,34 +244,28 @@ EOT
}
close $old_file;
my $oldstuff = join(', ', @old_vars);
- print <<EOT
-
-The following variables are no longer used in $filename, and
-have been moved to $filename_old: $oldstuff
-
-EOT
+ print install_string('lc_old_vars',
+ { localconfig => $filename, old_file => $filename_old,
+ vars => $oldstuff }), "\n";
}
# Re-write localconfig
open(my $fh, ">$filename") || die "$filename: $!";
foreach my $var (LOCALCONFIG_VARS) {
- print $fh "\n", $var->{desc},
- Data::Dumper->Dump([$localconfig->{$var->{name}}],
- ["*$var->{name}"]);
+ my $name = $var->{name};
+ my $desc = install_string("localconfig_$name", { root => ROOT_USER });
+ chomp($desc);
+ # Make the description into a comment.
+ $desc =~ s/^/# /mg;
+ print $fh $desc, "\n",
+ Data::Dumper->Dump([$localconfig->{$name}],
+ ["*$name"]), "\n";
}
if (@new_vars) {
my $newstuff = join(', ', @new_vars);
- print <<EOT;
-
-This version of Bugzilla contains some variables that you may want to
-change and adapt to your local settings. Please edit the file
-$filename and rerun checksetup.pl.
-
-The following variables are new to $filename since you last ran
-checksetup.pl: $newstuff
-
-EOT
+ print "\n", install_string('lc_new_vars',
+ { localconfig => $filename, new_vars => $newstuff }), "\n";
exit;
}
@@ -402,13 +275,6 @@ EOT
return { old_vars => \@old_vars, new_vars => \@new_vars };
}
-sub _get_default_cvsbin { return bin_loc('cvs') }
-sub _get_default_interdiffbin { return bin_loc('interdiff') }
-sub _get_default_diffpath {
- my $diff_bin = bin_loc('diff');
- return dirname($diff_bin);
-}
-
1;
__END__
diff --git a/Bugzilla/Install/Requirements.pm b/Bugzilla/Install/Requirements.pm
index 12a9c20c5..25dc15665 100644
--- a/Bugzilla/Install/Requirements.pm
+++ b/Bugzilla/Install/Requirements.pm
@@ -501,16 +501,19 @@ sub _translate_feature {
sub check_graphviz {
my ($output) = @_;
- return 1 if (Bugzilla->params->{'webdotbase'} =~ /^https?:/);
+ my $webdotbase = Bugzilla->params->{'webdotbase'};
+ return 1 if $webdotbase =~ /^https?:/;
- printf("Checking for %15s %-9s ", "GraphViz", "(any)") if $output;
+ my $checking_for = install_string('checking_for');
+ my $any = install_string('any');
+ printf("%s %15s %-9s ", $checking_for, "GraphViz", "($any)") if $output;
my $return = 0;
- if(-x Bugzilla->params->{'webdotbase'}) {
- print "ok: found\n" if $output;
+ if(-x $webdotbase) {
+ print install_string('module_ok'), "\n" if $output;
$return = 1;
} else {
- print "not a valid executable: " . Bugzilla->params->{'webdotbase'} . "\n";
+ print install_string('bad_executable', { bin => $webdotbase }), "\n";
}
my $webdotdir = bz_locations()->{'webdotdir'};
@@ -519,8 +522,8 @@ sub check_graphviz {
my $htaccess = new IO::File("$webdotdir/.htaccess", 'r')
|| die "$webdotdir/.htaccess: " . $!;
if (!grep(/png/, $htaccess->getlines)) {
- print "Dependency graph images are not accessible.\n";
- print "delete $webdotdir/.htaccess and re-run checksetup.pl to fix.\n";
+ print STDERR install_string('webdot_bad_htaccess',
+ { dir => $webdotdir }), "\n";
}
$htaccess->close;
}