Index: core/filter.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/install_profile_api/core/Attic/filter.inc,v
retrieving revision 1.1.2.4.2.1
diff -u -p -r1.1.2.4.2.1 filter.inc
--- core/filter.inc	1 Jun 2009 21:52:04 -0000	1.1.2.4.2.1
+++ core/filter.inc	1 Jun 2009 22:31:16 -0000
@@ -34,6 +34,36 @@ function install_add_format($name, $cach
 }
 
 /**
+ * Remove an existing input format.
+ *
+ * @param $name
+ *   The human-readable name of the format.
+ * @return
+ *   The deleted format ID, or FALSE if the format is not found.
+ */
+function install_remove_format($name) {
+  $format = db_result(db_query("SELECT format FROM {filter_formats} WHERE name = '%s'", $name));
+
+  if ($format) {
+    db_query("DELETE FROM {filter_formats} WHERE format = %d", $format);
+    db_query("DELETE FROM {filters} WHERE format = %d", $format);
+
+    $default = variable_get('filter_default_format', 1);
+    // Replace existing instances of the deleted format with the default format.
+    db_query("UPDATE {node_revisions} SET format = %d WHERE format = %d", $default, $format);
+    db_query("UPDATE {comments} SET format = %d WHERE format = %d", $default, $format);
+    db_query("UPDATE {boxes} SET format = %d WHERE format = %d", $default, $format);
+
+    cache_clear_all($format . ':', 'cache_filter', TRUE);
+  }
+  else {
+    $format = FALSE;
+  }
+
+  return $format;
+}
+
+/**
  * Remove the specified filter from the specified format.
  * @param $format_id
  *   The ID of the format to remove the filter from.
