summaryrefslogtreecommitdiffstats
path: root/checksetup.pl
diff options
context:
space:
mode:
authorbugreport%peshkin.net <>2002-12-20 16:16:28 +0100
committerbugreport%peshkin.net <>2002-12-20 16:16:28 +0100
commit1a3c26e61fa709824d63fce85c41d89bd90774fd (patch)
treef8a96173112554d46401117ef28ca0e3d618f6d9 /checksetup.pl
parent3154b337738036d402321654046ed453059d82da (diff)
downloadbugzilla-1a3c26e61fa709824d63fce85c41d89bd90774fd.tar.gz
bugzilla-1a3c26e61fa709824d63fce85c41d89bd90774fd.tar.xz
Bug 185760: New group system doesn't upgrade transparently if usebuggroups = 0
r=justdave a=justdave
Diffstat (limited to 'checksetup.pl')
-rwxr-xr-xchecksetup.pl69
1 files changed, 33 insertions, 36 deletions
diff --git a/checksetup.pl b/checksetup.pl
index bc9aeab96..fbe0c0051 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -3472,47 +3472,44 @@ if (TableExists("attachstatuses") && TableExists("attachstatusdefs")) {
# 2002-11-24 - bugreport@peshkin.net - bug 147275
#
-if (Param('makeproductgroups')) {
- # If makeproductgroups is enabled and group_control_map is empty,
- # backward-compatbility usebuggroups-equivalent records should
- # be created.
- my $entry = Param('useentrygroupdefault');
- $sth = $dbh->prepare("SELECT COUNT(*) FROM group_control_map");
+# If group_control_map is empty, backward-compatbility
+# usebuggroups-equivalent records should be created.
+my $entry = Param('useentrygroupdefault');
+$sth = $dbh->prepare("SELECT COUNT(*) FROM group_control_map");
+$sth->execute();
+my ($mapcnt) = $sth->fetchrow_array();
+if ($mapcnt == 0) {
+ # Initially populate group_control_map.
+ # First, get all the existing products and their groups.
+ $sth = $dbh->prepare("SELECT groups.id, products.id, groups.name, " .
+ "products.name FROM groups, products " .
+ "WHERE isbuggroup != 0 AND isactive != 0");
$sth->execute();
- my ($mapcnt) = $sth->fetchrow_array();
- if ($mapcnt == 0) {
- # Initially populate group_control_map.
- # First, get all the existing products and their groups.
- $sth = $dbh->prepare("SELECT groups.id, products.id, groups.name, " .
- "products.name FROM groups, products " .
- "WHERE isbuggroup != 0 AND isactive != 0");
- $sth->execute();
- while (my ($groupid, $productid, $groupname, $productname)
- = $sth->fetchrow_array()) {
- if ($groupname eq $productname) {
- # Product and group have same name.
+ while (my ($groupid, $productid, $groupname, $productname)
+ = $sth->fetchrow_array()) {
+ if ($groupname eq $productname) {
+ # Product and group have same name.
+ $dbh->do("INSERT INTO group_control_map " .
+ "(group_id, product_id, entry, membercontrol, " .
+ "othercontrol, canedit) " .
+ "VALUES ($groupid, $productid, $entry, " .
+ CONTROLMAPDEFAULT . ", " .
+ CONTROLMAPNA . ", 0)");
+ } else {
+ # See if this group is a product group at all.
+ my $sth2 = $dbh->prepare("SELECT id FROM products WHERE name = " .
+ $dbh->quote($groupname));
+ $sth2->execute();
+ my ($id) = $sth2->fetchrow_array();
+ if (!$id) {
+ # If there is no product with the same name as this
+ # group, then it is permitted for all products.
$dbh->do("INSERT INTO group_control_map " .
"(group_id, product_id, entry, membercontrol, " .
"othercontrol, canedit) " .
- "VALUES ($groupid, $productid, $entry, " .
- CONTROLMAPDEFAULT . ", " .
+ "VALUES ($groupid, $productid, 0, " .
+ CONTROLMAPSHOWN . ", " .
CONTROLMAPNA . ", 0)");
- } else {
- # See if this group is a product group at all.
- my $sth2 = $dbh->prepare("SELECT id FROM products WHERE name = " .
- $dbh->quote($groupname));
- $sth2->execute();
- my ($id) = $sth2->fetchrow_array();
- if (!$id) {
- # If there is no product with the same name as this
- # group, then it is permitted for all products.
- $dbh->do("INSERT INTO group_control_map " .
- "(group_id, product_id, entry, membercontrol, " .
- "othercontrol, canedit) " .
- "VALUES ($groupid, $productid, 0, " .
- CONTROLMAPSHOWN . ", " .
- CONTROLMAPNA . ", 0)");
- }
}
}
}