From 0ba610226fa41e854724bad5b901f8286b64bb6d Mon Sep 17 00:00:00 2001 From: vfilippov Date: Mon, 14 Sep 2009 14:26:24 +0000 Subject: [PATCH] Bug 40933 Merge with Bugzilla 3.4.2, released 11.09.2009 git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@416 6955db30-a419-402b-8a0d-67ecbb4d7f56 --- Bugzilla/BugMail.pm | 15 +- Bugzilla/Chart.pm | 6 +- Bugzilla/Constants.pm | 2 +- Bugzilla/DB.pm | 22 + Bugzilla/DB/Mysql.pm | 16 +- Bugzilla/Hook.pm | 27 ++ Bugzilla/Install/Requirements.pm | 15 +- Bugzilla/Install/Util.pm | 1 + Bugzilla/Job/Mailer.pm | 2 +- Bugzilla/JobQueue/Runner.pm | 140 +++++- Bugzilla/Object.pm | 28 +- Bugzilla/Series.pm | 32 +- Bugzilla/Template.pm | 1 + Bugzilla/WebService/Bug.pm | 1 + Bugzilla/WebService/Constants.pm | 2 + Bugzilla/WebService/Server/XMLRPC.pm | 10 - collectstats.pl | 111 +++-- docs/bugzilla.ent | 3 +- docs/en/html/Bugzilla-Guide.html | 436 ++++-------------- docs/en/html/about.html | 8 +- docs/en/html/administration.html | 6 +- docs/en/html/api/Bugzilla/Hook.html | 28 ++ docs/en/html/api/index.html | 4 +- docs/en/html/api/jobqueue.html | 25 +- docs/en/html/attachments.html | 4 +- docs/en/html/bug_page.html | 4 +- docs/en/html/bug_status_workflow.html | 4 +- docs/en/html/bugreports.html | 4 +- docs/en/html/classifications.html | 4 +- docs/en/html/cmdline-bugmail.html | 4 +- docs/en/html/cmdline.html | 4 +- docs/en/html/components.html | 4 +- docs/en/html/configuration.html | 63 ++- docs/en/html/conventions.html | 4 +- docs/en/html/copyright.html | 4 +- docs/en/html/credits.html | 4 +- docs/en/html/cust-change-permissions.html | 4 +- docs/en/html/cust-hooks.html | 4 +- docs/en/html/cust-skins.html | 4 +- docs/en/html/cust-templates.html | 8 +- docs/en/html/custom-fields.html | 4 +- docs/en/html/customization.html | 4 +- docs/en/html/disclaimer.html | 4 +- docs/en/html/edit-values.html | 4 +- docs/en/html/extraconfig.html | 6 +- docs/en/html/flags-overview.html | 4 +- docs/en/html/flags.html | 4 +- docs/en/html/general-advice.html | 4 +- docs/en/html/gfdl-0.html | 4 +- docs/en/html/gfdl-1.html | 4 +- docs/en/html/gfdl-10.html | 4 +- docs/en/html/gfdl-2.html | 4 +- docs/en/html/gfdl-3.html | 4 +- docs/en/html/gfdl-4.html | 4 +- docs/en/html/gfdl-5.html | 4 +- docs/en/html/gfdl-6.html | 4 +- docs/en/html/gfdl-7.html | 4 +- docs/en/html/gfdl-8.html | 4 +- docs/en/html/gfdl-9.html | 4 +- docs/en/html/gfdl-howto.html | 6 +- docs/en/html/gfdl.html | 6 +- docs/en/html/glossary.html | 14 +- docs/en/html/groups.html | 6 +- docs/en/html/hintsandtips.html | 6 +- docs/en/html/index.html | 34 +- docs/en/html/install-perlmodules-manual.html | 4 +- docs/en/html/installation.html | 13 +- docs/en/html/installing-bugzilla.html | 18 +- docs/en/html/integration.html | 4 +- docs/en/html/keywords.html | 4 +- docs/en/html/lifecycle.html | 4 +- docs/en/html/milestones.html | 4 +- docs/en/html/modules-manual-download.html | 22 +- docs/en/html/modules-manual-instructions.html | 4 +- docs/en/html/modules-manual-optional.html | 4 +- docs/en/html/multiple-bz-dbs.html | 4 +- docs/en/html/myaccount.html | 4 +- docs/en/html/newversions.html | 6 +- docs/en/html/nonroot.html | 24 +- docs/en/html/os-specific.html | 6 +- docs/en/html/parameters.html | 4 +- docs/en/html/paranoid-security.html | 4 +- docs/en/html/patches.html | 4 +- docs/en/html/products.html | 4 +- docs/en/html/query.html | 20 +- docs/en/html/quips.html | 4 +- docs/en/html/reporting.html | 6 +- docs/en/html/sanitycheck.html | 4 +- docs/en/html/security-bugzilla.html | 8 +- docs/en/html/security-os.html | 14 +- docs/en/html/security-webserver.html | 18 +- docs/en/html/security.html | 36 +- docs/en/html/timetracking.html | 4 +- docs/en/html/trbl-dbdsponge.html | 4 +- docs/en/html/trbl-index.html | 4 +- docs/en/html/trbl-passwd-encryption.html | 4 +- docs/en/html/trbl-perlmodule.html | 4 +- docs/en/html/trbl-relogin-everyone.html | 8 +- docs/en/html/trbl-relogin-some.html | 4 +- docs/en/html/trbl-testserver.html | 4 +- docs/en/html/troubleshooting.html | 4 +- docs/en/html/upgrade.html | 4 +- docs/en/html/useradmin.html | 4 +- docs/en/html/userpreferences.html | 4 +- docs/en/html/using-intro.html | 4 +- docs/en/html/using.html | 8 +- docs/en/html/versions.html | 4 +- docs/en/html/voting.html | 4 +- docs/en/html/whining.html | 6 +- docs/en/txt/Bugzilla-Guide.txt | 114 ++--- docs/en/xml/Bugzilla-Guide.xml | 4 +- docs/en/xml/bugzilla.ent | 3 +- docs/en/xml/customization.xml | 4 +- docs/en/xml/glossary.xml | 3 +- docs/en/xml/installation.xml | 34 +- docs/en/xml/modules.xml | 8 - docs/en/xml/security.xml | 91 +--- jobqueue.pl | 27 +- page.cgi | 7 +- show_bug.cgi | 2 +- .../en/default/admin/groups/edit.html.tmpl | 2 +- template/en/default/bug/comments.html.tmpl | 4 +- template/en/default/bug/show.xml.tmpl | 21 +- .../en/default/email/newchangedmail.txt.tmpl | 5 + .../en/default/global/code-error.html.tmpl | 5 + .../en/default/global/common-links.html.tmpl | 2 +- .../en/default/global/setting-descs.none.tmpl | 2 + .../en/default/pages/release-notes.html.tmpl | 52 +++ .../en/default/reports/create-chart.html.tmpl | 30 +- .../default/reports/series-common.html.tmpl | 10 +- template/en/default/request/email.txt.tmpl | 5 +- token.cgi | 4 + 132 files changed, 937 insertions(+), 1049 deletions(-) diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm index 14f4e9b19..ac85a7335 100644 --- a/Bugzilla/BugMail.pm +++ b/Bugzilla/BugMail.pm @@ -341,11 +341,10 @@ sub Send { @diff_tmp = (); } $lastbug = $depbug; - my $urlbase = Bugzilla->params->{"urlbase"}; $thisdiff = "\nBug $id depends on bug $depbug, which changed state.\n\n" . "Bug $depbug Summary: $summary\n" . - "${urlbase}show_bug.cgi?id=$depbug\n\n"; + correct_urlbase() . "show_bug.cgi?id=$depbug\n\n"; $thisdiff .= three_columns("What ", "Old Value", "New Value"); $thisdiff .= ('-' x 76) . "\n"; $interestingchange = 0; @@ -381,7 +380,7 @@ sub Send { if ($deptext) { - push @diffparts, { text => "\n" . trim("\n\n" . $deptext) }; + push @diffparts, { text => "\n" . trim($deptext) }; } } @@ -616,12 +615,14 @@ sub sendMail } } - if (!$difftext && !$newcomments && !@$newcomments && !$isnew) { + if ($difftext eq "" && !scalar(@$newcomments) && !$isnew) { # Whoops, no differences! return 0; } my $diffs = $difftext; + # Remove extra newlines. + $diffs =~ s/^\n+//s; $diffs =~ s/\n+$//s; my @showfieldvalues = (); # for HTML emails if ($isnew) { my $head = ""; @@ -724,9 +725,15 @@ sub get_comments_by_bug { my $raw = 0; # Do not format comments which are not of type CMT_NORMAL. my $comments = Bugzilla::Bug::GetComments($id, "oldest_to_newest", $start, $end, $raw); + my $attach_base = correct_urlbase() . 'attachment.cgi?id='; foreach my $comment (@$comments) { $comment->{count} = $count++; + # If an attachment was created, then add an URL. (Note: the 'g'lobal + # replace should work with comments with multiple attachments.) + if ($comment->{body} =~ /Created an attachment \(/) { + $comment->{body} =~ s/(Created an attachment \(id=([0-9]+)\))/$1\n --> \($attach_base$2\)/g; + } } if (Bugzilla->params->{'insidergroup'}) { diff --git a/Bugzilla/Chart.pm b/Bugzilla/Chart.pm index 1f232f310..58089d29e 100644 --- a/Bugzilla/Chart.pm +++ b/Bugzilla/Chart.pm @@ -396,10 +396,10 @@ sub getVisibleSeries { "LEFT JOIN category_group_map AS cgm " . " ON series.category = cgm.category_id " . " AND cgm.group_id NOT IN($grouplist) " . - "WHERE creator = " . Bugzilla->user->id . " OR " . - " cgm.category_id IS NULL " . + "WHERE creator = ? OR (is_public = 1 AND cgm.category_id IS NULL) " . $dbh->sql_group_by('series.series_id', 'cc1.name, cc2.name, ' . - 'series.name')); + 'series.name'), + undef, Bugzilla->user->id); foreach my $series (@$serieses) { my ($cat, $subcat, $name, $series_id) = @$series; $cats{$cat}{$subcat}{$name} = $series_id; diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm index a84893e10..44b3905d6 100644 --- a/Bugzilla/Constants.pm +++ b/Bugzilla/Constants.pm @@ -169,7 +169,7 @@ use File::Basename; # CONSTANTS # # Bugzilla version -use constant BUGZILLA_VERSION => "3.4.1"; +use constant BUGZILLA_VERSION => "3.4.2"; # These are unique values that are unlikely to match a string or a number, # to be used in criteria for match() functions and other things. They start diff --git a/Bugzilla/DB.pm b/Bugzilla/DB.pm index 5b42ea6e6..2c5b0a7f8 100644 --- a/Bugzilla/DB.pm +++ b/Bugzilla/DB.pm @@ -747,6 +747,28 @@ sub bz_drop_fk { } +sub bz_drop_related_fks { + my ($self, $table, $column) = @_; + my @tables = $self->_bz_real_schema->get_table_list(); + my @dropped; + foreach my $check_table (@tables) { + my @columns = $self->bz_table_columns($check_table); + foreach my $check_column (@columns) { + my $def = $self->bz_column_info($check_table, $check_column); + my $fk = $def->{REFERENCES}; + if ($fk + and (($fk->{TABLE} eq $table and $fk->{COLUMN} eq $column) + or ($check_column eq $column and $check_table eq $table))) + { + $self->bz_drop_fk($check_table, $check_column); + push(@dropped, [$check_table, $check_column, $fk]); + } + } # foreach $column + } # foreach $table + + return \@dropped; +} + sub bz_drop_index { my ($self, $table, $name) = @_; diff --git a/Bugzilla/DB/Mysql.pm b/Bugzilla/DB/Mysql.pm index 9d444e44c..20f0035ee 100644 --- a/Bugzilla/DB/Mysql.pm +++ b/Bugzilla/DB/Mysql.pm @@ -325,7 +325,7 @@ EOT my @isam_tables; foreach my $row (@$table_status) { my ($name, $type) = @$row; - push(@isam_tables, $name) if $type eq "ISAM"; + push(@isam_tables, $name) if (defined($type) && $type eq "ISAM"); } if(scalar(@isam_tables)) { @@ -370,7 +370,7 @@ EOT my @myisam_tables; foreach my $row (@$table_status) { my ($name, $type) = @$row; - if ($type =~ /^MYISAM$/i + if (defined ($type) && $type =~ /^MYISAM$/i && !grep($_ eq $name, Bugzilla::DB::Schema::Mysql::MYISAM_TABLES)) { push(@myisam_tables, $name) ; @@ -674,7 +674,7 @@ EOT my $utf_table_status = $self->selectall_arrayref("SHOW TABLE STATUS", {Slice=>{}}); $self->_after_table_status([map($_->{Name}, @$utf_table_status)]); - my @non_utf8_tables = grep($_->{Collation} !~ /^utf8/, @$utf_table_status); + my @non_utf8_tables = grep(defined($_->{Collation}) && $_->{Collation} !~ /^utf8/, @$utf_table_status); if (Bugzilla->params->{'utf8'} && scalar @non_utf8_tables) { print <bz_table_list_real) { my $info_sth = $self->prepare("SHOW FULL COLUMNS FROM $table"); $info_sth->execute(); @@ -749,13 +750,15 @@ EOT $self->bz_drop_index('test_runs', 'test_runs_summary_idx'); } + my $dropped = $self->bz_drop_related_fks($table, $name); + push(@dropped_fks, @$dropped); + print "Converting $table.$name to be stored as UTF-8...\n"; my $col_info = $self->bz_column_info_real($table, $name); # CHANGE COLUMN doesn't take PRIMARY KEY delete $col_info->{PRIMARYKEY}; - my $sql_def = $self->_bz_schema->get_type_ddl($col_info); # We don't want MySQL to actually try to *convert* # from our current charset to UTF-8, we just want to @@ -782,7 +785,12 @@ EOT } $self->do("ALTER TABLE $table DEFAULT CHARACTER SET utf8"); + } # foreach my $table (@tables) + + foreach my $fk_args (@dropped_fks) { + $self->bz_add_fk(@$fk_args); + } } # Sometimes you can have a situation where all the tables are utf8, diff --git a/Bugzilla/Hook.pm b/Bugzilla/Hook.pm index 5bc2e7716..de35f93b5 100644 --- a/Bugzilla/Hook.pm +++ b/Bugzilla/Hook.pm @@ -478,6 +478,33 @@ Params: =back +=head2 page-before_template + +This is a simple way to add your own pages to Bugzilla. This hooks C, +which loads templates from F