]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 387831: Deleting products does not clean up the component_cc table - Patch by...
authorlpsolit%gmail.com <>
Thu, 12 Jul 2007 07:41:38 +0000 (07:41 +0000)
committerlpsolit%gmail.com <>
Thu, 12 Jul 2007 07:41:38 +0000 (07:41 +0000)
editproducts.cgi
sanitycheck.cgi

index b458f60bf4276770d20832e9d77e97a27d478a93..dac5799ad9fd4dc7d4d6d4b864bb292417210f2c 100755 (executable)
@@ -408,9 +408,16 @@ if ($action eq 'delete') {
 
     $dbh->bz_lock_tables('products WRITE', 'components WRITE',
                          'versions WRITE', 'milestones WRITE',
-                         'group_control_map WRITE',
+                         'group_control_map WRITE', 'component_cc WRITE',
                          'flaginclusions WRITE', 'flagexclusions WRITE');
 
+    my $comp_ids = $dbh->selectcol_arrayref('SELECT id FROM components
+                                             WHERE product_id = ?',
+                                             undef, $product->id);
+
+    $dbh->do('DELETE FROM component_cc WHERE component_id IN
+              (' . join(',', @$comp_ids) . ')') if scalar(@$comp_ids);
+
     $dbh->do("DELETE FROM components WHERE product_id = ?",
              undef, $product->id);
 
index bf8ba1980b0200e269f76949dcb179c2d53f4d9f..43ab8c72e0a510420f7fa40a74902c746edf75a4 100755 (executable)
@@ -471,7 +471,8 @@ CrossCheck("profiles", "userid",
            ["tokens", "userid"],
            ["user_group_map", "user_id"],
            ["components", "initialowner", "name"],
-           ["components", "initialqacontact", "name"]);
+           ["components", "initialqacontact", "name"],
+           ["component_cc", "user_id"]);
 
 CrossCheck("products", "id",
            ["bugs", "product_id", "bug_id"],
@@ -482,6 +483,9 @@ CrossCheck("products", "id",
            ["flaginclusions", "product_id", "type_id"],
            ["flagexclusions", "product_id", "type_id"]);
 
+CrossCheck("components", "id",
+           ["component_cc", "component_id"]);
+
 # Check the former enum types -mkanat@bugzilla.org
 CrossCheck("bug_status", "value",
             ["bugs", "bug_status", "bug_id"]);