]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Fixed very very nasty bug which, when deleting a component, would tell
authorterry%mozilla.org <>
Fri, 17 Dec 1999 11:41:12 +0000 (11:41 +0000)
committerterry%mozilla.org <>
Fri, 17 Dec 1999 11:41:12 +0000 (11:41 +0000)
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.

editcomponents.cgi
editproducts.cgi
editversions.cgi

index 1c45a311a4cafcacbf2b039ae1561c00603974ee..2d7e9d81b4e1b7839600b234431680e0b5987f9e 100755 (executable)
@@ -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) . "
index 0b90c3d62c361a9803598b10e08c8a65abbd7e16..5e54813a2f2b21f9f58a1e9e3e53b62e24f82c3f 100755 (executable)
@@ -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));
index 8adab915fab5436c3d74e85e7b51ebf4ad052c8d..1ac768d6d0f1069522630d7c7c476780a7138642 100755 (executable)
@@ -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) . "