summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortravis%sedsystems.ca <>2005-02-02 02:43:26 +0100
committertravis%sedsystems.ca <>2005-02-02 02:43:26 +0100
commit80e765fbe8bf23ba27b5484bdb3a65c7aa723d6f (patch)
treee3763af4b6a4b243ca8a602487c12c4ce1a12f95
parent6139fe45717768df3b593c46c236b20781d9f790 (diff)
downloadbugzilla-80e765fbe8bf23ba27b5484bdb3a65c7aa723d6f.tar.gz
bugzilla-80e765fbe8bf23ba27b5484bdb3a65c7aa723d6f.tar.xz
Bug 279740 : Move CountOpenDependencies out of globals.pl
Patch by Max Kanat-Alexander <mkanat@kerio.com> r=wurblzap a=justdave
-rwxr-xr-xBugzilla/Bug.pm26
-rw-r--r--globals.pl32
-rwxr-xr-xprocess_bug.cgi2
3 files changed, 27 insertions, 33 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index ad48e763f..8f08d8c25 100755
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -536,6 +536,32 @@ sub GetComments {
return \@comments;
}
+# CountOpenDependencies counts the number of open dependent bugs for a
+# list of bugs and returns a list of bug_id's and their dependency count
+# It takes one parameter:
+# - A list of bug numbers whose dependencies are to be checked
+sub CountOpenDependencies {
+ my (@bug_list) = @_;
+ my @dependencies;
+ my $dbh = Bugzilla->dbh;
+
+ my $sth = $dbh->prepare(
+ "SELECT blocked, count(bug_status) " .
+ "FROM bugs, dependencies " .
+ "WHERE blocked IN (" . (join "," , @bug_list) . ") " .
+ "AND bug_id = dependson " .
+ "AND bug_status IN ('" . (join "','", &::OpenStates()) . "') " .
+ "GROUP BY blocked ");
+ $sth->execute();
+
+ while (my ($bug_id, $dependencies) = $sth->fetchrow_array()) {
+ push(@dependencies, { bug_id => $bug_id,
+ dependencies => $dependencies });
+ }
+
+ return @dependencies;
+}
+
sub AUTOLOAD {
use vars qw($AUTOLOAD);
my $attr = $AUTOLOAD;
diff --git a/globals.pl b/globals.pl
index 1529a0f6a..b48963412 100644
--- a/globals.pl
+++ b/globals.pl
@@ -999,38 +999,6 @@ sub GetBugLink {
}
}
-# CountOpenDependencies counts the number of open dependent bugs for a
-# list of bugs and returns a list of bug_id's and their dependency count
-# It takes one parameter:
-# - A list of bug numbers whose dependencies are to be checked
-
-sub CountOpenDependencies {
- my (@bug_list) = @_;
- my @dependencies;
-
- # Make sure any unfetched data from a currently running query
- # is saved off rather than overwritten
- PushGlobalSQLState();
-
- SendSQL("SELECT blocked, count(bug_status) " .
- "FROM bugs, dependencies " .
- "WHERE blocked IN (" . (join "," , @bug_list) . ") " .
- "AND bug_id = dependson " .
- "AND bug_status IN ('" . (join "','", OpenStates()) . "') " .
- "GROUP BY blocked ");
-
- while (MoreSQLData()) {
- my ($bug_id, $dependencies) = FetchSQLData();
- push(@dependencies, { bug_id => $bug_id,
- dependencies => $dependencies });
- }
-
- # All done with this sidetrip
- PopGlobalSQLState();
-
- return @dependencies;
-}
-
sub GetLongDescriptionAsText {
my ($id, $start, $end) = (@_);
my $result = "";
diff --git a/process_bug.cgi b/process_bug.cgi
index 2efc62d59..c560e90ff 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -935,7 +935,7 @@ SWITCH: for ($::FORM{'knob'}) {
if (Param("noresolveonopenblockers")
&& $::FORM{'resolution'} eq 'FIXED')
{
- my @dependencies = CountOpenDependencies(@idlist);
+ my @dependencies = Bugzilla::Bug::CountOpenDependencies(@idlist);
if (scalar @dependencies > 0) {
ThrowUserError("still_unresolved_bugs",
{ dependencies => \@dependencies,