=== modified file 'modules/taxonomy/taxonomy.module'
--- modules/taxonomy/taxonomy.module	2007-06-22 16:08:56 +0000
+++ modules/taxonomy/taxonomy.module	2007-06-23 18:03:49 +0000
@@ -364,8 +364,8 @@ function taxonomy_save_vocabulary(&$edit
 function taxonomy_del_vocabulary($vid) {
   $vocabulary = (array) taxonomy_vocabulary_load($vid);
 
-  db_query('DELETE FROM {vocabulary} WHERE vid = %d', $vid);
-  db_query('DELETE FROM {vocabulary_node_types} WHERE vid = %d', $vid);
+  drupal_delete_add_query('DELETE FROM {vocabulary} WHERE vid = %d', $vid);
+  drupal_delete_add_query('DELETE FROM {vocabulary_node_types} WHERE vid = %d', $vid);
   $result = db_query('SELECT tid FROM {term_data} WHERE vid = %d', $vid);
   while ($term = db_fetch_object($result)) {
     taxonomy_del_term($term->tid);
@@ -373,33 +373,36 @@ function taxonomy_del_vocabulary($vid) {
 
   module_invoke_all('taxonomy', 'delete', 'vocabulary', $vocabulary);
 
-  cache_clear_all();
-
   return SAVED_DELETED;
 }
 
 function taxonomy_vocabulary_confirm_delete(&$form_state, $vid) {
   $vocabulary = taxonomy_vocabulary_load($vid);
 
-  $form['type'] = array('#type' => 'value', '#value' => 'vocabulary');
-  $form['vid'] = array('#type' => 'value', '#value' => $vid);
-  $form['name'] = array('#type' => 'value', '#value' => $vocabulary->name);
-
-  $options = array('description' => t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'));
-
-  return confirm_form($form,
-                  t('Are you sure you want to delete the vocabulary %title?',
-                  array('%title' => $vocabulary->name)),
-                  'admin/content/taxonomy',
-                  $options);
-}
-
-function taxonomy_vocabulary_confirm_delete_submit($form, &$form_state) {
-  $status = taxonomy_del_vocabulary($form_state['values']['vid']);
-  drupal_set_message(t('Deleted vocabulary %name.', array('%name' => $form_state['values']['name'])));
-  watchdog('taxonomy', 'Deleted vocabulary %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE);
-  $form_state['redirect'] = 'admin/content/taxonomy';
-  return;
+  drupal_delete_initiate('vocabulary', $vid);
+
+  taxonomy_del_vocabulary($vid);
+
+  drupal_delete_add_callback(
+    array(
+      'taxonomy_vocabulary_confirm_delete_post' => array($vocabulary),
+      'cache_clear_all' => array(),
+    )
+  );
+
+  return drupal_delete_confirm(
+    array(
+      'question' => t('Are you sure you want to delete the vocabulary %title?', array('%title' => $vocabulary->name)),
+      'cancel' => 'admin/content/taxonomy',
+      'description' => t('Deleting a vocabulary will delete all the terms in it. This action cannot be undone.'),
+      'destination' => 'admin/content/taxonomy',
+    )
+  );
+}
+
+function taxonomy_vocabulary_confirm_delete_post($vocabulary) {
+  drupal_set_message(t('Deleted vocabulary %name.', array('%name' => $vocabulary->name)));
+  watchdog('taxonomy', 'Deleted vocabulary %name.', array('%name' => $vocabulary->name), WATCHDOG_NOTICE);
 }
 
 function taxonomy_form_term(&$form_state, $vocabulary, $edit = array()) {
@@ -515,9 +518,6 @@ function taxonomy_save_term(&$form_value
     $hook = 'update';
     $status = SAVED_UPDATED;
   }
-  else if (!empty($form_values['tid'])) {
-    return taxonomy_del_term($form_values['tid']);
-  }
   else {
     db_query("INSERT INTO {term_data} (name, description, vid, weight) VALUES ('%s', '%s', %d, %d)", $form_values['name'], $form_values['description'], $form_values['vid'], $form_values['weight']);
     $form_values['tid'] = db_last_insert_id('term_data', 'tid');
@@ -598,11 +598,11 @@ function taxonomy_del_term($tid) {
 
       $term = (array) taxonomy_get_term($tid);
 
-      db_query('DELETE FROM {term_data} WHERE tid = %d', $tid);
-      db_query('DELETE FROM {term_hierarchy} WHERE tid = %d', $tid);
-      db_query('DELETE FROM {term_relation} WHERE tid1 = %d OR tid2 = %d', $tid, $tid);
-      db_query('DELETE FROM {term_synonym} WHERE tid = %d', $tid);
-      db_query('DELETE FROM {term_node} WHERE tid = %d', $tid);
+      drupal_delete_add_query('DELETE FROM {term_data} WHERE tid = %d', $tid);
+      drupal_delete_add_query('DELETE FROM {term_hierarchy} WHERE tid = %d', $tid);
+      drupal_delete_add_query('DELETE FROM {term_relation} WHERE tid1 = %d OR tid2 = %d', $tid, $tid);
+      drupal_delete_add_query('DELETE FROM {term_synonym} WHERE tid = %d', $tid);
+      drupal_delete_add_query('DELETE FROM {term_node} WHERE tid = %d', $tid);
 
       module_invoke_all('taxonomy', 'delete', 'term', $term);
     }
@@ -618,25 +618,25 @@ function taxonomy_del_term($tid) {
 function taxonomy_term_confirm_delete(&$form_state, $tid) {
   $term = taxonomy_get_term($tid);
 
-  $form['type'] = array('#type' => 'value', '#value' => 'term');
-  $form['name'] = array('#type' => 'value', '#value' => $term->name);
-  $form['tid'] = array('#type' => 'value', '#value' => $tid);
-
-  $options = array('description' => t('Deleting a term will delete all its children if there are any. This action cannot be undone.'));
-
-  return confirm_form($form,
-                  t('Are you sure you want to delete the term %title?',
-                  array('%title' => $term->name)),
-                  'admin/content/taxonomy',
-                  $options);
-}
-
-function taxonomy_term_confirm_delete_submit($form, &$form_state) {
-  taxonomy_del_term($form_state['values']['tid']);
-  drupal_set_message(t('Deleted term %name.', array('%name' => $form_state['values']['name'])));
-  watchdog('taxonomy', 'Deleted term %name.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE);
-  $form_state['redirect'] = 'admin/content/taxonomy';
-  return;
+  drupal_delete_initiate('term', $tid);
+
+  taxonomy_del_term($tid);
+
+  drupal_delete_add_callback(array('taxonomy_term_confirm_delete_post' => array($term)));
+
+  return drupal_delete_confirm(
+    array(
+      'question' => t('Are you sure you want to delete the term %title?', array('%title' => $term->name)),
+      'cancel' => 'admin/content/taxonomy',
+      'description' => t('Deleting a term will delete all its children if there are any. This action cannot be undone.'),
+      'destination' => 'admin/content/taxonomy',
+    )
+  );
+}
+
+function taxonomy_term_confirm_delete_post($term) {
+  drupal_set_message(t('Deleted term %name.', array('%name' => $term->name)));
+  watchdog('taxonomy', 'Deleted term %name.', array('%name' => $term->name), WATCHDOG_NOTICE);
 }
 
 /**
@@ -817,7 +817,7 @@ function taxonomy_node_validate(&$node) 
  */
 function taxonomy_node_save($node, $terms) {
 
-  taxonomy_node_delete_revision($node);
+  db_query('DELETE FROM {term_node} WHERE vid = %d', $node->vid);
 
   // Free tagging vocabularies do not send their tids in the form,
   // so we'll detect them here and process them independently.
@@ -875,20 +875,6 @@ function taxonomy_node_save($node, $term
 }
 
 /**
- * Remove associations of a node to its terms.
- */
-function taxonomy_node_delete($node) {
-  drupal_delete_add_query('DELETE FROM {term_node} WHERE nid = %d', $node->nid);
-}
-
-/**
- * Remove associations of a node to its terms.
- */
-function taxonomy_node_delete_revision($node) {
-  drupal_delete_add_query('DELETE FROM {term_node} WHERE vid = %d', $node->vid);
-}
-
-/**
  * Implementation of hook_node_type().
  */
 function taxonomy_node_type($op, $info) {
@@ -1320,11 +1306,11 @@ function taxonomy_nodeapi($node, $op, $a
       break;
 
     case 'delete':
-      taxonomy_node_delete($node);
+      drupal_delete_add_query('DELETE FROM {term_node} WHERE nid = %d', $node->nid);
       break;
 
     case 'delete revision':
-      taxonomy_node_delete_revision($node);
+      drupal_delete_add_query('DELETE FROM {term_node} WHERE vid = %d', $node->vid);
       break;
 
     case 'validate':

