diff options
author | lpsolit%gmail.com <> | 2007-07-12 09:40:02 +0200 |
---|---|---|
committer | lpsolit%gmail.com <> | 2007-07-12 09:40:02 +0200 |
commit | 23c63e06693b324f5ea61555fd150ac4a158679a (patch) | |
tree | 530bc8940870b2b1c1d5643dff313da6c99559e8 | |
parent | dc9f2badbb567a3104c72cc148c78cf587f03a43 (diff) | |
download | bugzilla-23c63e06693b324f5ea61555fd150ac4a158679a.tar.gz bugzilla-23c63e06693b324f5ea61555fd150ac4a158679a.tar.xz |
Bug 387831: Deleting products does not clean up the component_cc table - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
-rwxr-xr-x | editproducts.cgi | 9 | ||||
-rwxr-xr-x | sanitycheck.cgi | 6 |
2 files changed, 13 insertions, 2 deletions
diff --git a/editproducts.cgi b/editproducts.cgi index b458f60bf..dac5799ad 100755 --- a/editproducts.cgi +++ b/editproducts.cgi @@ -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); diff --git a/sanitycheck.cgi b/sanitycheck.cgi index 58033b828..db25f5842 100755 --- a/sanitycheck.cgi +++ b/sanitycheck.cgi @@ -453,7 +453,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"], @@ -464,6 +465,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"]); |