From: lpsolit%gmail.com <> Date: Thu, 9 Jun 2005 04:09:41 +0000 (+0000) Subject: Bug 225042: If sendmail dies while processing a duplicate it corrupts the duplicates... X-Git-Tag: bugzilla-2.18.2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=299a5b2d37b97cf7646cebf1dd35f911c624d3dc;p=thirdparty%2Fbugzilla.git Bug 225042: If sendmail dies while processing a duplicate it corrupts the duplicates table - Patch by Frédéric Buclin r=vladd a=justdave --- diff --git a/process_bug.cgi b/process_bug.cgi index 36651fa1a5..c78673af78 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -1712,19 +1712,6 @@ foreach my $id (@idlist) { } SendSQL("UNLOCK TABLES"); - $vars->{'mailrecipients'} = { 'cc' => \@ccRemoved, - 'owner' => $origOwner, - 'qacontact' => $origQaContact, - 'changer' => $::COOKIE{'Bugzilla_login'} }; - - $vars->{'id'} = $id; - - # Let the user know the bug was changed and who did and didn't - # receive email about the change. - $template->process("bug/process/results.html.tmpl", $vars) - || ThrowTemplateError($template->error()); - $vars->{'header_done'} = 1; - if ($duplicate) { # Check to see if Reporter of this bug is reporter of Dupe SendSQL("SELECT reporter FROM bugs WHERE bug_id = " . SqlQuote($::FORM{'id'})); @@ -1744,7 +1731,27 @@ foreach my $id (@idlist) { AppendComment($duplicate, $::COOKIE{'Bugzilla_login'}, "*** Bug $::FORM{'id'} has been marked as a duplicate of this bug. ***", 0); CheckFormFieldDefined(\%::FORM,'comment'); SendSQL("INSERT INTO duplicates VALUES ($duplicate, $::FORM{'id'})"); + } + + # Now all changes to the DB have been made. It's time to email + # all concerned users, including the bug itself, but also the + # duplicated bug and dependent bugs, if any. + $vars->{'mailrecipients'} = { 'cc' => \@ccRemoved, + 'owner' => $origOwner, + 'qacontact' => $origQaContact, + 'changer' => $::COOKIE{'Bugzilla_login'} }; + + $vars->{'id'} = $id; + + # Let the user know the bug was changed and who did and didn't + # receive email about the change. + $template->process("bug/process/results.html.tmpl", $vars) + || ThrowTemplateError($template->error()); + $vars->{'header_done'} = 1; + + + if ($duplicate) { $vars->{'mailrecipients'} = { 'changer' => $::COOKIE{'Bugzilla_login'} };