diff options
author | gerv%gerv.net <> | 2002-06-29 03:02:09 +0000 |
---|---|---|
committer | gerv%gerv.net <> | 2002-06-29 03:02:09 +0000 |
commit | 7e0c45474fe5c9c52f77eadb3a8406d95342cfc0 (patch) | |
tree | 81232a0cdc9c3ce1d21e5b06e28abe18785ef323 /duplicates.cgi | |
parent | Bug 148488 - more HTML validation fixes (diff) | |
download | bugzilla-7e0c45474fe5c9c52f77eadb3a8406d95342cfc0.tar.gz bugzilla-7e0c45474fe5c9c52f77eadb3a8406d95342cfc0.tar.bz2 bugzilla-7e0c45474fe5c9c52f77eadb3a8406d95342cfc0.zip |
Bug 151281 - change duplicates.cgi to make one query instead of several thousand. Patch by gerv; r=myk, bbaetz.
Diffstat (limited to 'duplicates.cgi')
-rwxr-xr-x | duplicates.cgi | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/duplicates.cgi b/duplicates.cgi index 50affa6df..52e611cbf 100755 --- a/duplicates.cgi +++ b/duplicates.cgi @@ -110,6 +110,9 @@ my $threshold = Param("mostfreqthreshold"); while (my ($key, $value) = each %count) { delete $count{$key} if ($value < $threshold); + + # If there's a buglist, restrict the bugs to that list. + delete $count{$key} if $sortvisible && (lsearch(\@buglist, $key) == -1); } # Try and open the database from "changedsince" days ago @@ -135,33 +138,29 @@ if (!tie(%before, 'AnyDBM_File', "data/duplicates/dupes$whenever", # Don't add CLOSED, and don't add VERIFIED unless they are INVALID or # WONTFIX. We want to see VERIFIED INVALID and WONTFIX because common # "bugs" which aren't bugs end up in this state. -my $generic_query = " - SELECT component, bug_severity, op_sys, target_milestone, +my $query = " + SELECT bugs.bug_id, component, bug_severity, op_sys, target_milestone, short_desc, bug_status, resolution FROM bugs WHERE (bug_status != 'CLOSED') AND ((bug_status = 'VERIFIED' AND resolution IN ('INVALID', 'WONTFIX')) OR (bug_status != 'VERIFIED')) - AND "; + AND bugs.bug_id IN (" . join(", ", keys %count) . ")"; # Limit to a single product if requested -$generic_query .= (" product = " . SqlQuote($product) . " AND ") if $product; +$query .= (" AND product = " . SqlQuote($product)) if $product; +SendSQL(SelectVisible($query, + $userid, + $usergroupset)); + my @bugs; my @bug_ids; -my $loop = 0; -foreach my $id (keys(%count)) { - # Maximum row count is dealt with in the template. - # If there's a buglist, restrict the bugs to that list. - next if $sortvisible && $buglist[0] && (lsearch(\@buglist, $id) == -1); - - SendSQL(SelectVisible("$generic_query bugs.bug_id = $id", - $userid, - $usergroupset)); - - next unless MoreSQLData(); - my ($component, $bug_severity, $op_sys, $target_milestone, +while (MoreSQLData()) { + # Note: maximum row count is dealt with in the template. + + my ($id, $component, $bug_severity, $op_sys, $target_milestone, $short_desc, $bug_status, $resolution) = FetchSQLData(); # Limit to open bugs only if requested @@ -178,7 +177,6 @@ foreach my $id (keys(%count)) { bug_status => $bug_status, resolution => $resolution }); push (@bug_ids, $id); - $loop++; } $vars->{'bugs'} = \@bugs; |