Index: flag.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/flag/Attic/flag.module,v
retrieving revision 1.11.2.72.2.29
diff -u -r1.11.2.72.2.29 flag.module
--- flag.module	3 Nov 2009 03:09:05 -0000	1.11.2.72.2.29
+++ flag.module	6 Nov 2009 03:54:28 -0000
@@ -802,6 +802,7 @@
   // Always return an array (even if empty) of accesses.
   return $access;
 }
+
 /**
  * Trim a flag to a certain size.
  *
@@ -823,6 +824,27 @@
 }
 
 /**
+ * Remove all flagged content from a flag.
+ *
+ * @param $flag
+ *   The flag object.
+ * @param $content_id
+ *   Optional. The content ID on which all flaggings will be removed. If left
+ *   empty, this will remove all of this flag's content.
+ */
+function flag_reset_flag($flag, $content_id = NULL) {
+  $result = db_query("SELECT * FROM {flag_content} WHERE fid = %d" . ($content_id ? " AND content_id = %d" : ''), $flag->fid, $content_id);
+  $rows = array();
+  while ($row = db_fetch_array($result)) {
+    $rows[] = $row;
+  }
+  module_invoke_all('flag_reset', $flag, $content_id, $rows);
+
+  db_query("DELETE FROM {flag_content} WHERE fid = %d" . ($content_id ? " AND content_id = %d" : ''), $flag->fid, $content_id);
+  return db_affected_rows();
+}
+
+/**
  * Implementation of hook_node_operations().
  *
  * Add additional options on the admin/build/node page.
