summaryrefslogtreecommitdiffstats
path: root/sanitycheck.cgi
diff options
context:
space:
mode:
authorbugreport%peshkin.net <>2002-11-25 04:56:17 +0100
committerbugreport%peshkin.net <>2002-11-25 04:56:17 +0100
commitc64d51111a5ae02d6fc45163a847d0b7e2004548 (patch)
treefd7a0cb912e4411573faa5305df4d4971a3b6dda /sanitycheck.cgi
parente7720dcdd4e332c096a310c53412d3acaacd381e (diff)
downloadbugzilla-c64d51111a5ae02d6fc45163a847d0b7e2004548.tar.gz
bugzilla-c64d51111a5ae02d6fc45163a847d0b7e2004548.tar.xz
Bug 147275 Rearchitect product groups
Patch by joel r=bbaetz,justdave a=justdave
Diffstat (limited to 'sanitycheck.cgi')
-rwxr-xr-xsanitycheck.cgi50
1 files changed, 50 insertions, 0 deletions
diff --git a/sanitycheck.cgi b/sanitycheck.cgi
index 8977ce3b5..49c007f7f 100755
--- a/sanitycheck.cgi
+++ b/sanitycheck.cgi
@@ -26,6 +26,7 @@ use strict;
use lib qw(.);
require "CGI.pl";
+use Bugzilla::Constants;
use vars qw(%FORM $unconfirmedstate);
@@ -263,6 +264,7 @@ CrossCheck("groups", "id",
["bug_group_map", "group_id"],
["group_group_map", "grantor_id"],
["group_group_map", "member_id"],
+ ["group_control_map", "group_id"],
["user_group_map", "group_id"]);
CrossCheck("profiles", "userid",
@@ -288,6 +290,7 @@ CrossCheck("products", "id",
["components", "product_id", "name"],
["milestones", "product_id", "value"],
["versions", "product_id", "value"],
+ ["group_control_map", "product_id"],
["flaginclusions", "product_id", "type_id"],
["flagexclusions", "product_id", "type_id"]);
@@ -613,6 +616,53 @@ DateCheck("groups", "last_changed");
DateCheck("profiles", "refreshed_when");
###########################################################################
+# Control Values
+###########################################################################
+
+# Checks for values that are invalid OR
+# not among the 9 valid combinations
+Status("Checking for bad values in group_control_map");
+SendSQL("SELECT COUNT(product_id) FROM group_control_map WHERE " .
+ "membercontrol NOT IN(" . CONTROLMAPNA . "," . CONTROLMAPSHOWN .
+ "," . CONTROLMAPDEFAULT . "," . CONTROLMAPMANDATORY . ")" .
+ " OR " .
+ "othercontrol NOT IN(" . CONTROLMAPNA . "," . CONTROLMAPSHOWN .
+ "," . CONTROLMAPDEFAULT . "," . CONTROLMAPMANDATORY . ")" .
+ " OR " .
+ "( (membercontrol != othercontrol) " .
+ "AND (membercontrol != " . CONTROLMAPSHOWN . ") " .
+ "AND ((membercontrol != " . CONTROLMAPDEFAULT . ") " .
+ "OR (othercontrol = " . CONTROLMAPSHOWN . ")))");
+my $c = FetchOneColumn();
+if ($c) {
+ Alert("Found $c bad group_control_map entries");
+}
+
+Status("Checking for bugs with groups violating their product's group controls");
+BugCheck("bugs, groups, bug_group_map
+ LEFT JOIN group_control_map
+ ON group_control_map.product_id = bugs.product_id
+ AND group_control_map.group_id = bug_group_map.group_id
+ WHERE bugs.bug_id = bug_group_map.bug_id
+ AND bug_group_map.group_id = groups.id
+ AND groups.isactive != 0
+ AND ((group_control_map.membercontrol = " . CONTROLMAPNA . ")
+ OR (group_control_map.membercontrol IS NULL))",
+ "Have groups not permitted for their products");
+
+BugCheck("bugs, groups, group_control_map
+ LEFT JOIN bug_group_map
+ ON group_control_map.group_id = bug_group_map.group_id
+ AND bugs.bug_id = bug_group_map.bug_id
+ WHERE group_control_map.product_id = bugs.product_id
+ AND bug_group_map.group_id = groups.id
+ AND groups.isactive != 0
+ AND group_control_map.membercontrol = " . CONTROLMAPMANDATORY . "
+ AND bug_group_map.group_id IS NULL",
+ "Are missing groups required for their products");
+
+
+###########################################################################
# Unsent mail
###########################################################################