From c48c345eb62acb75a46db84f5d6ab53d164d01ef Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Tue, 23 Aug 2005 19:17:16 +0000 Subject: Bug 303366: Possible locking tables conflict when voting for bugs - Patch by Frédéric Buclin r=wurblzap a=justdave MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- editproducts.cgi | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'editproducts.cgi') diff --git a/editproducts.cgi b/editproducts.cgi index d6d909360..59ff7bdec 100755 --- a/editproducts.cgi +++ b/editproducts.cgi @@ -1369,16 +1369,28 @@ if ($action eq 'update') { } } # 3. enough votes to confirm - SendSQL("SELECT bug_id FROM bugs " . - "WHERE product_id = $product_id " . - " AND bug_status = 'UNCONFIRMED' " . - " AND votes >= $votestoconfirm"); - if (MoreSQLData()) { + my $bug_list = $dbh->selectcol_arrayref("SELECT bug_id FROM bugs + WHERE product_id = ? + AND bug_status = 'UNCONFIRMED' + AND votes >= ?", + undef, ($product_id, $votestoconfirm)); + if (scalar(@$bug_list)) { print "
Checking unconfirmed bugs in this product for any which now have sufficient votes."; } - while (MoreSQLData()) { - # The user id below is used for activity log purposes - CheckIfVotedConfirmed(FetchOneColumn(), Bugzilla->user->id); + my @updated_bugs = (); + foreach my $bug_id (@$bug_list) { + my $confirmed = CheckIfVotedConfirmed($bug_id, $whoid); + push (@updated_bugs, $bug_id) if $confirmed; + } + + $vars->{'type'} = "votes"; + $vars->{'mailrecipients'} = { 'changer' => $whoid }; + $vars->{'header_done'} = 1; + + foreach my $bug_id (@updated_bugs) { + $vars->{'id'} = $bug_id; + $template->process("bug/process/results.html.tmpl", $vars) + || ThrowTemplateError($template->error()); } } -- cgit v1.2.3-24-g4f1b