diff options
author | terry%mozilla.org <> | 1999-12-17 12:41:12 +0100 |
---|---|---|
committer | terry%mozilla.org <> | 1999-12-17 12:41:12 +0100 |
commit | f78955364bb90d95b295af690eb16a90ee5b9db8 (patch) | |
tree | c9f07f61e6b116aa4ccf3942271fe7bbbcaa20ed /editversions.cgi | |
parent | 653e191956e726707d6ee2f322644c6f5ed036a6 (diff) | |
download | bugzilla-f78955364bb90d95b295af690eb16a90ee5b9db8.tar.gz bugzilla-f78955364bb90d95b295af690eb16a90ee5b9db8.tar.xz |
Fixed very very nasty bug which, when deleting a component, would tell
you it had no bugs (even when it had some), and would then proceed to
delete all those bugs (even if you had the param set to never allow
bug deletion.) Added some paranoia to prevent such things from
happening again. Yikes.
Diffstat (limited to 'editversions.cgi')
-rwxr-xr-x | editversions.cgi | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/editversions.cgi b/editversions.cgi index 8adab915f..1ac768d6d 100755 --- a/editversions.cgi +++ b/editversions.cgi @@ -427,29 +427,35 @@ if ($action eq 'delete') { # so I have to iterate over bugs and delete all the indivial entries # in bugs_activies and attachments. - SendSQL("SELECT bug_id + if (Param("allowbugdeletion")) { + + SendSQL("SELECT bug_id FROM bugs WHERE product=" . SqlQuote($product) . " AND version=" . SqlQuote($version)); - while (MoreSQLData()) { - my $bugid = FetchOneColumn(); + while (MoreSQLData()) { + my $bugid = FetchOneColumn(); - my $query = $::db->query("DELETE FROM attachments WHERE bug_id=$bugid") + my $query = + $::db->query("DELETE FROM attachments WHERE bug_id=$bugid") or die "$::db_errstr"; - $query = $::db->query("DELETE FROM bugs_activity WHERE bug_id=$bugid") + $query = + $::db->query("DELETE FROM bugs_activity WHERE bug_id=$bugid") or die "$::db_errstr"; - $query = $::db->query("DELETE FROM dependencies WHERE blocked=$bugid") + $query = + $::db->query("DELETE FROM dependencies WHERE blocked=$bugid") or die "$::db_errstr"; - } - print "Attachments, bug activity and dependencies deleted.<BR>\n"; + } + print "Attachments, bug activity and dependencies deleted.<BR>\n"; - # Deleting the rest is easier: + # Deleting the rest is easier: - SendSQL("DELETE FROM bugs + SendSQL("DELETE FROM bugs WHERE product=" . SqlQuote($product) . " AND version=" . SqlQuote($version)); - print "Bugs deleted.<BR>\n"; + print "Bugs deleted.<BR>\n"; + } SendSQL("DELETE FROM versions WHERE program=" . SqlQuote($product) . " |