summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorterry%mozilla.org <>1999-12-17 12:41:12 +0100
committerterry%mozilla.org <>1999-12-17 12:41:12 +0100
commitf78955364bb90d95b295af690eb16a90ee5b9db8 (patch)
treec9f07f61e6b116aa4ccf3942271fe7bbbcaa20ed
parent653e191956e726707d6ee2f322644c6f5ed036a6 (diff)
downloadbugzilla-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.
-rwxr-xr-xeditcomponents.cgi32
-rwxr-xr-xeditproducts.cgi27
-rwxr-xr-xeditversions.cgi28
3 files changed, 51 insertions, 36 deletions
diff --git a/editcomponents.cgi b/editcomponents.cgi
index 1c45a311a..2d7e9d81b 100755
--- a/editcomponents.cgi
+++ b/editcomponents.cgi
@@ -481,10 +481,9 @@ if ($action eq 'del') {
print " <TD VALIGN=\"top\">Initial QA contact:</TD>\n";
print " <TD VALIGN=\"top\">$initialqacontact</TD>";
}
- SendSQL("SELECT count(bug_id),product,component
+ SendSQL("SELECT count(bug_id)
FROM bugs
- GROUP BY product
- HAVING product=" . SqlQuote($product) . "
+ WHERE product=" . SqlQuote($product) . "
AND component=" . SqlQuote($component));
print "</TR><TR>\n";
@@ -568,29 +567,34 @@ 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 component=" . SqlQuote($component));
- 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 component=" . SqlQuote($component));
- print "Bugs deleted.<BR>\n";
+ print "Bugs deleted.<BR>\n";
+ }
SendSQL("DELETE FROM components
WHERE program=" . SqlQuote($product) . "
diff --git a/editproducts.cgi b/editproducts.cgi
index 0b90c3d62..5e54813a2 100755
--- a/editproducts.cgi
+++ b/editproducts.cgi
@@ -443,27 +443,32 @@ 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));
- 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));
- print "Bugs deleted.<BR>\n";
+ print "Bugs deleted.<BR>\n";
+ }
SendSQL("DELETE FROM components
WHERE program=" . SqlQuote($product));
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) . "