From: lpsolit%gmail.com <> Date: Thu, 12 Jul 2007 07:41:38 +0000 (+0000) Subject: Bug 387831: Deleting products does not clean up the component_cc table - Patch by... X-Git-Tag: bugzilla-3.0.1~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc9373870178be8e6de37ed33e29456341a9451c;p=thirdparty%2Fbugzilla.git Bug 387831: Deleting products does not clean up the component_cc table - Patch by Frédéric Buclin r/a=mkanat --- diff --git a/editproducts.cgi b/editproducts.cgi index b458f60bf4..dac5799ad9 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 bf8ba1980b..43ab8c72e0 100755 --- a/sanitycheck.cgi +++ b/sanitycheck.cgi @@ -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"]);