Commit f7895536 authored by terry%mozilla.org's avatar terry%mozilla.org

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.
parent 653e1919
...@@ -481,10 +481,9 @@ if ($action eq 'del') { ...@@ -481,10 +481,9 @@ if ($action eq 'del') {
print " <TD VALIGN=\"top\">Initial QA contact:</TD>\n"; print " <TD VALIGN=\"top\">Initial QA contact:</TD>\n";
print " <TD VALIGN=\"top\">$initialqacontact</TD>"; print " <TD VALIGN=\"top\">$initialqacontact</TD>";
} }
SendSQL("SELECT count(bug_id),product,component SendSQL("SELECT count(bug_id)
FROM bugs FROM bugs
GROUP BY product WHERE product=" . SqlQuote($product) . "
HAVING product=" . SqlQuote($product) . "
AND component=" . SqlQuote($component)); AND component=" . SqlQuote($component));
print "</TR><TR>\n"; print "</TR><TR>\n";
...@@ -568,6 +567,7 @@ if ($action eq 'delete') { ...@@ -568,6 +567,7 @@ if ($action eq 'delete') {
# so I have to iterate over bugs and delete all the indivial entries # so I have to iterate over bugs and delete all the indivial entries
# in bugs_activies and attachments. # in bugs_activies and attachments.
if (Param("allowbugdeletion")) {
SendSQL("SELECT bug_id SendSQL("SELECT bug_id
FROM bugs FROM bugs
WHERE product=" . SqlQuote($product) . " WHERE product=" . SqlQuote($product) . "
...@@ -575,11 +575,14 @@ if ($action eq 'delete') { ...@@ -575,11 +575,14 @@ if ($action eq 'delete') {
while (MoreSQLData()) { while (MoreSQLData()) {
my $bugid = FetchOneColumn(); 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"; 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"; 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"; or die "$::db_errstr";
} }
print "Attachments, bug activity and dependencies deleted.<BR>\n"; print "Attachments, bug activity and dependencies deleted.<BR>\n";
...@@ -591,6 +594,7 @@ if ($action eq 'delete') { ...@@ -591,6 +594,7 @@ if ($action eq 'delete') {
WHERE product=" . SqlQuote($product) . " WHERE product=" . SqlQuote($product) . "
AND component=" . SqlQuote($component)); AND component=" . SqlQuote($component));
print "Bugs deleted.<BR>\n"; print "Bugs deleted.<BR>\n";
}
SendSQL("DELETE FROM components SendSQL("DELETE FROM components
WHERE program=" . SqlQuote($product) . " WHERE program=" . SqlQuote($product) . "
......
...@@ -443,17 +443,21 @@ if ($action eq 'delete') { ...@@ -443,17 +443,21 @@ if ($action eq 'delete') {
# so I have to iterate over bugs and delete all the indivial entries # so I have to iterate over bugs and delete all the indivial entries
# in bugs_activies and attachments. # in bugs_activies and attachments.
if (Param("allowbugdeletion")) {
SendSQL("SELECT bug_id SendSQL("SELECT bug_id
FROM bugs FROM bugs
WHERE product=" . SqlQuote($product)); WHERE product=" . SqlQuote($product));
while (MoreSQLData()) { while (MoreSQLData()) {
my $bugid = FetchOneColumn(); 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"; 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"; 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"; or die "$::db_errstr";
} }
print "Attachments, bug activity and dependencies deleted.<BR>\n"; print "Attachments, bug activity and dependencies deleted.<BR>\n";
...@@ -464,6 +468,7 @@ if ($action eq 'delete') { ...@@ -464,6 +468,7 @@ if ($action eq 'delete') {
SendSQL("DELETE FROM bugs SendSQL("DELETE FROM bugs
WHERE product=" . SqlQuote($product)); WHERE product=" . SqlQuote($product));
print "Bugs deleted.<BR>\n"; print "Bugs deleted.<BR>\n";
}
SendSQL("DELETE FROM components SendSQL("DELETE FROM components
WHERE program=" . SqlQuote($product)); WHERE program=" . SqlQuote($product));
......
...@@ -427,6 +427,8 @@ if ($action eq 'delete') { ...@@ -427,6 +427,8 @@ if ($action eq 'delete') {
# so I have to iterate over bugs and delete all the indivial entries # so I have to iterate over bugs and delete all the indivial entries
# in bugs_activies and attachments. # in bugs_activies and attachments.
if (Param("allowbugdeletion")) {
SendSQL("SELECT bug_id SendSQL("SELECT bug_id
FROM bugs FROM bugs
WHERE product=" . SqlQuote($product) . " WHERE product=" . SqlQuote($product) . "
...@@ -434,11 +436,14 @@ if ($action eq 'delete') { ...@@ -434,11 +436,14 @@ if ($action eq 'delete') {
while (MoreSQLData()) { while (MoreSQLData()) {
my $bugid = FetchOneColumn(); 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"; 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"; 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"; or die "$::db_errstr";
} }
print "Attachments, bug activity and dependencies deleted.<BR>\n"; print "Attachments, bug activity and dependencies deleted.<BR>\n";
...@@ -450,6 +455,7 @@ if ($action eq 'delete') { ...@@ -450,6 +455,7 @@ if ($action eq 'delete') {
WHERE product=" . SqlQuote($product) . " WHERE product=" . SqlQuote($product) . "
AND version=" . SqlQuote($version)); AND version=" . SqlQuote($version));
print "Bugs deleted.<BR>\n"; print "Bugs deleted.<BR>\n";
}
SendSQL("DELETE FROM versions SendSQL("DELETE FROM versions
WHERE program=" . SqlQuote($product) . " WHERE program=" . SqlQuote($product) . "
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment