my $data = $self->data;
require Data::Dumper;
- print "<pre>Bugzilla::Chart object:\n";
+ say "<pre>Bugzilla::Chart object:";
print Data::Dumper::Dumper($self);
print "</pre>";
}
if (!$conn_success) {
$dbh = _get_no_db_connection();
- print "Creating database $db_name...\n";
+ say "Creating database $db_name...";
# Try to create the DB, and if we fail print a friendly error.
my $success = eval {
my @desired_tables = $self->_bz_schema->get_table_list();
my $bugs_exists = $self->bz_table_info('bugs');
if (!$bugs_exists) {
- print install_string('db_table_setup'), "\n";
+ say install_string('db_table_setup');
}
foreach my $table_name (@desired_tables) {
my $activity_fk = $self->bz_fk_info('profiles_activity', 'userid');
my $any_fks = $activity_fk && $activity_fk->{created};
if (!$any_fks) {
- print get_text('install_fk_setup'), "\n";
+ say get_text('install_fk_setup');
}
my @tables = $self->bz_table_list();
$table, $name, $new_def,
defined $set_nulls_to ? $self->quote($set_nulls_to) : undef);
my $new_ddl = $self->_bz_schema->get_type_ddl($new_def);
- print "Updating column $name in table $table ...\n";
+ say "Updating column $name in table $table ...";
if (defined $current_def) {
my $old_ddl = $self->_bz_schema->get_type_ddl($current_def);
- print "Old: $old_ddl\n";
+ say "Old: $old_ddl";
}
- print "New: $new_ddl\n";
+ say "New: $new_ddl";
$self->do($_) foreach (@statements);
}
if (Bugzilla->usage_mode == USAGE_MODE_CMDLINE
and !$options->{silently})
{
- print install_string('db_table_new', { table => $name }), "\n";
+ say install_string('db_table_new', { table => $name });
}
$self->do($_) foreach (@statements);
}
$self->_bz_add_table_raw('bz_schema');
}
- print install_string('db_schema_init'), "\n";
+ say install_string('db_schema_init');
my $sth = $self->prepare("INSERT INTO bz_schema "
." (schema_data, version) VALUES (?,?)");
$sth->bind_param(1, $store_me, $self->BLOB_TYPE);
# Instantiate a Field object for an existing field.
my $field = new Bugzilla::Field({name => 'qacontact_accessible'});
if ($field->obsolete) {
- print $field->description . " is obsolete\n";
+ say $field->description . " is obsolete";
}
# Validation Routines
undef, $field_description);
if ($old_field_id && ($old_field_name ne $new_field_name)) {
- print "SQL fragment found in the 'fielddefs' table...\n";
- print "Old field name: " . $old_field_name . "\n";
+ say "SQL fragment found in the 'fielddefs' table...";
+ say "Old field name: $old_field_name";
# We have to fix saved searches first. Queries have been escaped
# before being saved. We have to do the same here to find them.
$old_field_name = url_quote($old_field_name);
$sth_UpdateSeries->execute($query, $series_id);
}
# Now that saved searches have been fixed, we can fix the field name.
- print "Fixing the 'fielddefs' table...\n";
- print "New field name: " . $new_field_name . "\n";
+ say "Fixing the 'fielddefs' table...";
+ say "New field name: $new_field_name";
$dbh->do('UPDATE fielddefs SET name = ? WHERE id = ?',
undef, ($new_field_name, $old_field_id));
}
use Bugzilla::Product;
use Bugzilla::User;
use Bugzilla::User::Setting;
-use Bugzilla::Util qw(get_text);
+use Bugzilla::Util qw(get_text say);
use Bugzilla::Version;
use constant STATUS_WORKFLOW => (
my $any_settings = $dbh->selectrow_array(
'SELECT 1 FROM setting ' . $dbh->sql_limit(1));
if (!$any_settings) {
- print get_text('install_setting_setup'), "\n";
+ say get_text('install_setting_setup');
}
my %settings = %{SETTINGS()};
# adding groups.
my $editbugs_exists = new Bugzilla::Group({ name => 'editbugs' });
if (!$editbugs_exists) {
- print get_text('install_groups_setup'), "\n";
+ say get_text('install_groups_setup');
}
# Create most of the system groups
my $has_workflow = $dbh->selectrow_array('SELECT 1 FROM status_workflow');
return if $has_workflow;
- print get_text('install_workflow_init'), "\n";
+ say get_text('install_workflow_init');
my %status_ids = @{ $dbh->selectcol_arrayref(
'SELECT value, id FROM bug_status', {Columns=>[1,2]}) };
my $full_name = $answer{'ADMIN_REALNAME'};
if (!$login || !$password || !$full_name) {
- print "\n" . get_text('install_admin_setup') . "\n\n";
+ say "\n" . get_text('install_admin_setup') . "\n";
}
while (!$login) {
chomp $login;
eval { Bugzilla::User->check_login_name_for_creation($login); };
if ($@) {
- print $@ . "\n";
+ say $@;
undef $login;
}
}
}
if (Bugzilla->usage_mode == USAGE_MODE_CMDLINE) {
- print "\n", get_text('install_admin_created', { user => $user }), "\n";
+ say "\n", get_text('install_admin_created', { user => $user });
}
}
chomp $pass2;
eval { validate_password($password, $pass2); };
if ($@) {
- print "\n$@\n";
+ say "\n$@";
undef $password;
}
system("stty","echo") unless ON_WINDOWS;
my $password = _prompt_for_password($prompt);
$user->set_password($password);
$user->update();
- print "\n", get_text('install_reset_password_done'), "\n";
+ say "\n", get_text('install_reset_password_done');
}
1;
use Bugzilla::Install::Requirements ();
use Bugzilla::Install::Util qw(indicate_progress);
use Bugzilla::Product;
-use Bugzilla::Util qw(get_text trim generate_random_password);
+use Bugzilla::Util qw(get_text trim generate_random_password say);
use Bugzilla::User ();
use Bugzilla::Status ();
use Bugzilla::Version;
sub users {
my $self = shift;
if (!exists $self->{users}) {
- print get_text('migrate_reading_users'), "\n";
+ say get_text('migrate_reading_users');
$self->{users} = $self->_read_users();
}
return $self->{users};
sub products {
my $self = shift;
if (!exists $self->{products}) {
- print get_text('migrate_reading_products'), "\n";
+ say get_text('migrate_reading_products');
$self->{products} = $self->_read_products();
}
return $self->{products};
sub bugs {
my $self = shift;
if (!exists $self->{bugs}) {
- print get_text('migrate_reading_bugs'), "\n";
+ say get_text('migrate_reading_bugs');
$self->{bugs} = $self->_read_bugs();
}
return $self->{bugs};
sub translate_all_bugs {
my ($self, $bugs) = @_;
- print get_text('migrate_translating_bugs'), "\n";
+ say get_text('migrate_translating_bugs');
# We modify the array in place so that $self->bugs will return the
# modified bugs, in case $self->before_insert wants them.
my $num_bugs = scalar(@$bugs);
if (!$self->dry_run) {
$created = Bugzilla::Field->create($created);
}
- print get_text('migrate_field_created', { field => $created }), "\n";
+ say get_text('migrate_field_created', { field => $created });
}
delete $self->{bug_fields};
}
sub insert_bugs {
my ($self, $bugs) = @_;
my $dbh = Bugzilla->dbh;
- print get_text('migrate_creating_bugs'), "\n";
+ say get_text('migrate_creating_bugs');
my $init_statuses = Bugzilla::Status->can_change_to();
my %allowed_statuses = map { lc($_->name) => 1 } @$init_statuses;
use strict;
use base qw(Exporter);
-@Bugzilla::Util::EXPORT = qw(trick_taint detaint_natural
- detaint_signed
+@Bugzilla::Util::EXPORT = qw(trick_taint detaint_natural detaint_signed
html_quote url_quote xml_quote
css_class_quote html_light_quote url_decode
i_am_cgi correct_urlbase remote_ip
do_ssl_redirect_if_required use_attachbase
- diff_arrays on_main_db
+ diff_arrays on_main_db say
trim wrap_hard wrap_comment find_wrap_point
format_time validate_date validate_time datetime_from
file_mod_time is_7bit_clean
return (\@removed, \@added);
}
+# XXX - This is a temporary subroutine till we require Perl 5.10.1.
+# This will happen before Bugzilla 5.0rc1.
+sub say (@) {
+ print @_;
+ print "\n";
+}
+
sub trim {
my ($str) = @_;
if ($str) {
# prints out both data structures.
if ($cgi->param('debug')) {
require Data::Dumper;
- print "<pre>data hash:\n";
- print Data::Dumper::Dumper(%data) . "\n\n";
- print "data array:\n";
- print Data::Dumper::Dumper(@image_data) . "\n\n</pre>";
+ say "<pre>data hash:";
+ say Data::Dumper::Dumper(%data);
+ say "\ndata array:";
+ say Data::Dumper::Dumper(@image_data) . "\n\n</pre>";
}
# All formats point to the same section of the documentation.
}
else {
my $start_tag = $alert ? '<p class="alert">' : '<p>';
- print $start_tag . get_string($san_tag, $vars) . "</p>\n";
+ say $start_tag . get_string($san_tag, $vars) . "</p>";
}
}
use Bugzilla;
use Bugzilla::Constants;
+use Bugzilla::Util qw(say);
use Socket;
if ((@ARGV != 1) || ($ARGV[0] !~ /^https?:/))
{
- print "Usage: $0 <URL to this Bugzilla installation>\n";
- print "e.g.: $0 http://www.mycompany.com/bugzilla\n";
+ say "Usage: $0 <URL to this Bugzilla installation>";
+ say "e.g.: $0 http://www.mycompany.com/bugzilla";
exit(1);
}
# Check $webservergroup against the server's GID
if ($sgid > 0) {
if ($webservergroup eq "") {
- print
+ say
"WARNING \$webservergroup is set to an empty string.
That is a very insecure practice. Please refer to the
-Bugzilla documentation.\n";
+Bugzilla documentation.";
}
elsif ($webgroupnum == $sgid || Bugzilla->localconfig->{use_suexec}) {
- print "TEST-OK Webserver is running under group id in \$webservergroup.\n";
+ say "TEST-OK Webserver is running under group id in \$webservergroup.";
}
else {
- print
+ say
"TEST-WARNING Webserver is running under group id not matching \$webservergroup.
This if the tests below fail, this is probably the problem.
Please refer to the web server configuration section of the Bugzilla guide.
-If you are using virtual hosts or suexec, this warning may not apply.\n";
+If you are using virtual hosts or suexec, this warning may not apply.";
}
}
elsif (!ON_WINDOWS) {
- print
+ say
"TEST-WARNING Failed to find the GID for the 'httpd' process, unable
-to validate webservergroup.\n";
+to validate webservergroup.";
}
$ARGV[0] =~ s/\/$//;
my $url = $ARGV[0] . "/images/padlock.png";
if (fetch($url)) {
- print "TEST-OK Got padlock picture.\n";
+ say "TEST-OK Got padlock picture.";
} else {
- print
+ say
"TEST-FAILED Fetch of images/padlock.png failed
Your web server could not fetch $url.
-Check your web server configuration and try again.\n";
+Check your web server configuration and try again.";
exit(1);
}
# Try to execute a cgi script
my $response = fetch($ARGV[0] . "/testagent.cgi");
if ($response =~ /^OK (.*)$/) {
- print "TEST-OK Webserver is executing CGIs via $1.\n";
+ say "TEST-OK Webserver is executing CGIs via $1.";
} elsif ($response =~ /^#!/) {
- print
+ say
"TEST-FAILED Webserver is fetching rather than executing CGI files.
-Check the AddHandler statement in your httpd.conf file.\n";
+Check the AddHandler statement in your httpd.conf file.";
exit(1);
} else {
- print "TEST-FAILED Webserver is not executing CGI files.\n";
+ say "TEST-FAILED Webserver is not executing CGI files.";
}
# Make sure that the web server is honoring .htaccess files
$url = $ARGV[0] . "/$localconfig";
$response = fetch($url);
if ($response) {
- print
+ say
"TEST-FAILED Webserver is permitting fetch of $url.
This is a serious security problem.
-Check your web server configuration.\n";
+Check your web server configuration.";
exit(1);
} else {
- print "TEST-OK Webserver is preventing fetch of $url.\n";
+ say "TEST-OK Webserver is preventing fetch of $url.";
}
# Test chart generation
my $gdlib = `gdlib-config --version 2>&1` || "";
$gdlib =~ s/\n$//;
if (!$gdlib) {
- print "TEST-WARNING Failed to run gdlib-config; can't compare " .
- "GD versions.\n";
+ say "TEST-WARNING Failed to run gdlib-config; can't compare " .
+ "GD versions.";
}
else {
my $gd = $GD::VERSION;
$gd =~ s/^([^\.]+)\..*/$1/;
if ($gdlib == $gd) {
- print "TEST-OK $verstring; Major versions match.\n";
+ say "TEST-OK $verstring; Major versions match.";
} else {
- print "TEST-FAILED $verstring; Major versions do not match.\n";
+ say "TEST-FAILED $verstring; Major versions do not match.";
}
}
}
create_file("$datadir/testgd-local.png", $image->png);
check_image("$datadir/testgd-local.png", 'GD');
} else {
- print "TEST-FAILED GD doesn't support PNG generation.\n";
+ say "TEST-FAILED GD doesn't support PNG generation.";
}
};
if ($@ ne '') {
- print "TEST-FAILED GD returned: $@\n";
+ say "TEST-FAILED GD returned: $@";
}
# Test Chart
eval 'use Chart::Lines';
if ($@) {
- print "TEST-FAILED Chart::Lines is not installed.\n";
+ say "TEST-FAILED Chart::Lines is not installed.";
} else {
eval {
my $chart = Chart::Lines->new(400, 400);
check_image("$datadir/testchart-local.png", "Chart");
};
if ($@ ne '') {
- print "TEST-FAILED Chart returned: $@\n";
+ say "TEST-FAILED Chart returned: $@";
}
}
eval 'use Template::Plugin::GD::Image';
if ($@) {
- print "TEST-FAILED Template::Plugin::GD is not installed.\n";
+ say "TEST-FAILED Template::Plugin::GD is not installed.";
}
else {
- print "TEST-OK Template::Plugin::GD is installed.\n";
+ say "TEST-OK Template::Plugin::GD is installed.";
}
}
my ($local_file, $library) = @_;
my $filedata = read_file($local_file);
if ($filedata =~ /^\x89\x50\x4E\x47\x0D\x0A\x1A\x0A/) {
- print "TEST-OK $library library generated a good PNG image.\n";
+ say "TEST-OK $library library generated a good PNG image.";
unlink $local_file;
} else {
- print "TEST-WARNING $library library did not generate a good PNG.\n";
+ say "TEST-WARNING $library library did not generate a good PNG.";
}
}
MessageToMTA($msg);
- print "$email " . join(" ", @{$bugs{$email}}) . "\n";
+ say "$email " . join(" ", @{$bugs{$email}});
}