? install-filter-remove-472558-1.patch
? core/install-filter-remove-472558-1.patch
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
diff -u -p -r1.1.2.4 filter.inc
--- core/filter.inc	23 Sep 2008 04:13:46 -0000	1.1.2.4
+++ core/filter.inc	25 May 2009 22:07:42 -0000
@@ -34,6 +34,30 @@ 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.
+ */
+function install_remove_format($name) {
+  $format = db_result(db_query("SELECT format FROM {filter_formats} WHERE name = '%s'", $name));
+  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);
+
+  return $format;
+}
+
+/**
  * Remove the specified filter from the specified format.
  * @param $format_id
  *   The ID of the format to remove the filter from.
