Index: includes/file.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/file.inc,v
retrieving revision 1.235
diff -u -p -r1.235 file.inc
--- includes/file.inc	5 Oct 2010 06:23:18 -0000	1.235
+++ includes/file.inc	10 Oct 2010 15:34:06 -0000
@@ -1185,6 +1185,7 @@ function file_delete(stdClass $file, $fo

   // Let other modules clean up any references to the deleted file.
   module_invoke_all('file_delete', $file);
+  module_invoke_all('entity_delete', $file, 'file');

   // Make sure the file is deleted before removing its row from the
   // database, so UIs can still find the file in the database.
Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.904
diff -u -p -r1.904 comment.module
--- modules/comment/comment.module	5 Oct 2010 06:17:28 -0000	1.904
+++ modules/comment/comment.module	10 Oct 2010 15:34:09 -0000
@@ -1592,6 +1592,7 @@ function comment_delete_multiple($cids)
     foreach ($comments as $comment) {
       field_attach_delete('comment', $comment);
       module_invoke_all('comment_delete', $comment);
+      module_invoke_all('entity_delete', $comment, 'comment');

       // Delete the comment's replies.
       $child_cids = db_query('SELECT cid FROM {comment} WHERE pid = :cid', array(':cid' => $comment->cid))->fetchCol();
Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.1305
diff -u -p -r1.1305 node.module
--- modules/node/node.module	7 Oct 2010 00:28:20 -0000	1.1305
+++ modules/node/node.module	10 Oct 2010 15:34:12 -0000
@@ -1171,6 +1171,7 @@ function node_delete_multiple($nids) {
       // Call the node-specific callback (if any):
       node_invoke($node, 'delete');
       module_invoke_all('node_delete', $node);
+      module_invoke_all('entity_delete', $node, 'node');
       field_attach_delete('node', $node);

       // Remove this node from the search index if needed.
Index: modules/simpletest/simpletest.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/simpletest.info,v
retrieving revision 1.24
diff -u -p -r1.24 simpletest.info
--- modules/simpletest/simpletest.info	5 Oct 2010 20:04:19 -0000	1.24
+++ modules/simpletest/simpletest.info	10 Oct 2010 15:34:13 -0000
@@ -19,6 +19,7 @@ files[] = tests/bootstrap.test
 files[] = tests/cache.test
 files[] = tests/common.test
 files[] = tests/database_test.test
+files[] = tests/entity_crud_hook_test.test
 files[] = tests/entity_query.test
 files[] = tests/error.test
 files[] = tests/file.test
Index: modules/simpletest/tests/entity_crud_hook_test.info
===================================================================
RCS file: modules/simpletest/tests/entity_crud_hook_test.info
diff -N modules/simpletest/tests/entity_crud_hook_test.info
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/simpletest/tests/entity_crud_hook_test.info	10 Oct 2010 15:34:13 -0000
@@ -0,0 +1,9 @@
+; $Id$
+
+name = "Entity CRUD Hooks Test"
+description = "Support module for CRUD hook tests."
+core = 7.x
+package = Testing
+files[] = entity_crud_hook_test.module
+version = VERSION
+hidden = TRUE
Index: modules/simpletest/tests/entity_crud_hook_test.module
===================================================================
RCS file: modules/simpletest/tests/entity_crud_hook_test.module
diff -N modules/simpletest/tests/entity_crud_hook_test.module
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/simpletest/tests/entity_crud_hook_test.module	10 Oct 2010 15:34:13 -0000
@@ -0,0 +1,214 @@
+<?php
+// $Id: database_test.module,v 1.14 2010/06/25 19:33:47 dries Exp $
+
+//
+// Insert hooks
+//
+
+/**
+ * Implements hook_entity_insert().
+ */
+function entity_crud_hook_test_entity_insert($entity, $type) {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called for type ' . $type);
+}
+
+/**
+ * Implements hook_comment_insert().
+ */
+function entity_crud_hook_test_comment_insert() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+/**
+ * Implements hook_file_insert().
+ */
+function entity_crud_hook_test_file_insert() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+/**
+ * Implements hook_node_insert().
+ */
+function entity_crud_hook_test_node_insert() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+/**
+ * Implements hook_taxonomy_term_insert().
+ */
+function entity_crud_hook_test_taxonomy_term_insert() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+/**
+ * Implements hook_taxonomy_vocabulary_insert().
+ */
+function entity_crud_hook_test_taxonomy_vocabulary_insert() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+/**
+ * Implements hook_user_insert().
+ */
+function entity_crud_hook_test_user_insert() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+//
+// Load hooks
+//
+
+/**
+ * Implements hook_entity_load().
+ */
+function entity_crud_hook_test_entity_load(array $entities, $type) {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called for type ' . $type);
+}
+
+/**
+ * Implements hook_comment_load().
+ */
+function entity_crud_hook_test_comment_load() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+/**
+ * Implements hook_file_load().
+ */
+function entity_crud_hook_test_file_load() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+/**
+ * Implements hook_node_load().
+ */
+function entity_crud_hook_test_node_load() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+/**
+ * Implements hook_taxonomy_term_load().
+ */
+function entity_crud_hook_test_taxonomy_term_load() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+/**
+ * Implements hook_taxonomy_vocabulary_load().
+ */
+function entity_crud_hook_test_taxonomy_vocabulary_load() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+/**
+ * Implements hook_user_load().
+ */
+function entity_crud_hook_test_user_load() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+//
+// Update hooks
+//
+
+/**
+ * Implements hook_entity_update().
+ */
+function entity_crud_hook_test_entity_update($entity, $type) {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called for type ' . $type);
+}
+
+/**
+ * Implements hook_comment_update().
+ */
+function entity_crud_hook_test_comment_update() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+/**
+ * Implements hook_file_update().
+ */
+function entity_crud_hook_test_file_update() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+/**
+ * Implements hook_node_update().
+ */
+function entity_crud_hook_test_node_update() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+/**
+ * Implements hook_taxonomy_term_update().
+ */
+function entity_crud_hook_test_taxonomy_term_update() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+/**
+ * Implements hook_taxonomy_vocabulary_update().
+ */
+function entity_crud_hook_test_taxonomy_vocabulary_update() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+/**
+ * Implements hook_user_update().
+ */
+function entity_crud_hook_test_user_update() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+//
+// Delete hooks
+//
+
+/**
+ * Implements hook_entity_delete().
+ */
+function entity_crud_hook_test_entity_delete($entity, $type) {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called for type ' . $type);
+}
+
+/**
+ * Implements hook_comment_delete().
+ */
+function entity_crud_hook_test_comment_delete() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+/**
+ * Implements hook_file_delete().
+ */
+function entity_crud_hook_test_file_delete() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+/**
+ * Implements hook_node_delete().
+ */
+function entity_crud_hook_test_node_delete() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+/**
+ * Implements hook_taxonomy_term_delete().
+ */
+function entity_crud_hook_test_taxonomy_term_delete() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+/**
+ * Implements hook_taxonomy_vocabulary_delete().
+ */
+function entity_crud_hook_test_taxonomy_vocabulary_delete() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
+
+/**
+ * Implements hook_user_delete().
+ */
+function entity_crud_hook_test_user_delete() {
+  $_SESSION['entity_crud_hook_test'][] = (__FUNCTION__ . ' called');
+}
Index: modules/simpletest/tests/entity_crud_hook_test.test
===================================================================
RCS file: modules/simpletest/tests/entity_crud_hook_test.test
diff -N modules/simpletest/tests/entity_crud_hook_test.test
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/simpletest/tests/entity_crud_hook_test.test	10 Oct 2010 15:34:13 -0000
@@ -0,0 +1,299 @@
+<?php
+// $Id: database_test.test,v 1.103 2010/09/24 02:05:55 dries Exp $
+
+/**
+ * Test invocation of hooks when inserting, loading, updating or deleting an
+ * entity. Tested hooks are:
+ * - hook_entity_insert()
+ * - hook_entity_load()
+ * - hook_entity_update()
+ * - hook_entity_delete()
+ * As well as all type-specific hooks, like hook_node_insert(),
+ * hook_comment_update(), etc.
+ */
+class EntityCrudHookTestCase extends DrupalWebTestCase {
+
+  protected $ids = array();
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Entity CRUD hooks',
+      'description' => 'Tests the invocation of hooks when inserting, loading, updating or deleting an entity.',
+      'group' => 'Entity API',
+    );
+  }
+
+  public function setUp() {
+    parent::setUp('entity_crud_hook_test', 'taxonomy', 'comment');
+  }
+
+  /**
+   * Overrides assertText() to automatically set the message to the asserted
+   * text.
+   */
+  protected function assertHookMessage($text, $message = NULL, $group = 'Other') {
+    if (!isset($message)) {
+      $message = $text;
+    }
+    return $this->assertTrue(array_search($text, $_SESSION['entity_crud_hook_test']) !== FALSE, $message, $group);
+  }
+
+  /**
+   * Test hook invocations for CRUD operations on comments.
+   */
+  public function testCommentHooks() {
+    $node = (object) array(
+      'uid' => 1,
+      'type' => 'article',
+      'title' => 'Test node',
+      'status' => 1,
+      'comment' => 2,
+      'promote' => 0,
+      'sticky' => 0,
+      'language' => LANGUAGE_NONE,
+      'created' => REQUEST_TIME,
+      'changed' => REQUEST_TIME,
+    );
+    node_save($node);
+    $nid = $node->nid;
+
+    $comment = (object) array(
+      'cid' => NULL,
+      'pid' => 0,
+      'nid' => $nid,
+      'uid' => 1,
+      'subject' => 'Test comment',
+      'created' => REQUEST_TIME,
+      'changed' => REQUEST_TIME,
+      'status' => 1,
+      'language' => LANGUAGE_NONE,
+    );
+    $_SESSION['entity_crud_hook_test'] = array();
+    comment_save($comment);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_insert called for type comment');
+    $this->assertHookMessage('entity_crud_hook_test_comment_insert called');
+
+    $_SESSION['entity_crud_hook_test'] = array();
+    $comment = comment_load($comment->cid);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_load called for type comment');
+    $this->assertHookMessage('entity_crud_hook_test_comment_load called');
+
+    $_SESSION['entity_crud_hook_test'] = array();
+    $comment->subject = 'New subject';
+    comment_save($comment);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_update called for type comment');
+    $this->assertHookMessage('entity_crud_hook_test_comment_update called');
+
+    $_SESSION['entity_crud_hook_test'] = array();
+    comment_delete($comment->cid);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_delete called for type comment');
+    $this->assertHookMessage('entity_crud_hook_test_comment_delete called');
+  }
+
+  /**
+   * Test hook invocations for CRUD operations on files.
+   */
+  public function testFileHooks() {
+    $url = 'public://entity_crud_hook_test.file';
+    file_put_contents($url, 'Test test test');
+    $file = (object) array(
+      'fid' => NULL,
+      'uid' => 1,
+      'filename' => 'entity_crud_hook_test.file',
+      'uri' => $url,
+      'filemime' => 'text/plain',
+      'filesize' => filesize($url),
+      'status' => 1,
+      'timestamp' => REQUEST_TIME,
+    );
+    $_SESSION['entity_crud_hook_test'] = array();
+    file_save($file);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_insert called for type file');
+    $this->assertHookMessage('entity_crud_hook_test_file_insert called');
+
+    $_SESSION['entity_crud_hook_test'] = array();
+    $file = file_load($file->fid);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_load called for type file');
+    $this->assertHookMessage('entity_crud_hook_test_file_load called');
+
+    $_SESSION['entity_crud_hook_test'] = array();
+    $file->filename = 'new.entity_crud_hook_test.file';
+    file_save($file);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_update called for type file');
+    $this->assertHookMessage('entity_crud_hook_test_file_update called');
+
+    $_SESSION['entity_crud_hook_test'] = array();
+    file_delete($file);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_delete called for type file');
+    $this->assertHookMessage('entity_crud_hook_test_file_delete called');
+  }
+
+  /**
+   * Test hook invocations for CRUD operations on nodes.
+   */
+  public function testNodeHooks() {
+    $node = (object) array(
+      'uid' => 1,
+      'type' => 'article',
+      'title' => 'Test node',
+      'status' => 1,
+      'comment' => 2,
+      'promote' => 0,
+      'sticky' => 0,
+      'language' => LANGUAGE_NONE,
+      'created' => REQUEST_TIME,
+      'changed' => REQUEST_TIME,
+    );
+    $_SESSION['entity_crud_hook_test'] = array();
+    node_save($node);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_insert called for type node');
+    $this->assertHookMessage('entity_crud_hook_test_node_insert called');
+
+    $_SESSION['entity_crud_hook_test'] = array();
+    $node = node_load($node->nid);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_load called for type node');
+    $this->assertHookMessage('entity_crud_hook_test_node_load called');
+
+    $_SESSION['entity_crud_hook_test'] = array();
+    $node->title = 'New title';
+    node_save($node);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_update called for type node');
+    $this->assertHookMessage('entity_crud_hook_test_node_update called');
+
+    $_SESSION['entity_crud_hook_test'] = array();
+    node_delete($node->nid);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_delete called for type node');
+    $this->assertHookMessage('entity_crud_hook_test_node_delete called');
+  }
+
+  /**
+   * Test hook invocations for CRUD operations on taxonomy terms.
+   */
+  public function testTaxonomyTermHooks() {
+    $vocabulary = (object) array(
+      'name' => 'Test vocabulary',
+      'machine_name' => 'test',
+      'description' => NULL,
+      'module' => 'entity_crud_hook_test',
+    );
+    taxonomy_vocabulary_save($vocabulary);
+
+    $term = (object) array(
+      'vid' => $vocabulary->vid,
+      'name' => 'Test term',
+      'description' => NULL,
+      'format' => 1,
+    );
+    $_SESSION['entity_crud_hook_test'] = array();
+    taxonomy_term_save($term);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_insert called for type taxonomy_term');
+    $this->assertHookMessage('entity_crud_hook_test_taxonomy_term_insert called');
+
+    $_SESSION['entity_crud_hook_test'] = array();
+    $term = taxonomy_term_load($term->tid);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_load called for type taxonomy_term');
+    $this->assertHookMessage('entity_crud_hook_test_taxonomy_term_load called');
+
+    $_SESSION['entity_crud_hook_test'] = array();
+    $term->name = 'New name';
+    taxonomy_term_save($term);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_update called for type taxonomy_term');
+    $this->assertHookMessage('entity_crud_hook_test_taxonomy_term_update called');
+
+    $_SESSION['entity_crud_hook_test'] = array();
+    taxonomy_term_delete($term->tid);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_delete called for type taxonomy_term');
+    $this->assertHookMessage('entity_crud_hook_test_taxonomy_term_delete called');
+  }
+
+  /**
+   * Test hook invocations for CRUD operations on taxonomy vocabularies.
+   */
+  public function testTaxonomyVocabularyHooks() {
+    $vocabulary = (object) array(
+      'name' => 'Test vocabulary',
+      'machine_name' => 'test',
+      'description' => NULL,
+      'module' => 'entity_crud_hook_test',
+    );
+    $_SESSION['entity_crud_hook_test'] = array();
+    taxonomy_vocabulary_save($vocabulary);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_insert called for type taxonomy_vocabulary');
+    $this->assertHookMessage('entity_crud_hook_test_taxonomy_vocabulary_insert called');
+
+    $_SESSION['entity_crud_hook_test'] = array();
+    $vocabulary = taxonomy_vocabulary_load($vocabulary->vid);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_load called for type taxonomy_vocabulary');
+    $this->assertHookMessage('entity_crud_hook_test_taxonomy_vocabulary_load called');
+
+    $_SESSION['entity_crud_hook_test'] = array();
+    $vocabulary->name = 'New name';
+    taxonomy_vocabulary_save($vocabulary);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_update called for type taxonomy_vocabulary');
+    $this->assertHookMessage('entity_crud_hook_test_taxonomy_vocabulary_update called');
+
+    $_SESSION['entity_crud_hook_test'] = array();
+    taxonomy_vocabulary_delete($vocabulary->vid);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_delete called for type taxonomy_vocabulary');
+    $this->assertHookMessage('entity_crud_hook_test_taxonomy_vocabulary_delete called');
+  }
+
+  /**
+   * Test hook invocations for CRUD operations on users.
+   */
+  public function testUserHooks() {
+    $edit = array(
+      'name' => 'Test user',
+      'mail' => 'test@example.com',
+      'created' => REQUEST_TIME,
+      'status' => 1,
+      'language' => 'en',
+    );
+    $account = (object) $edit;
+    $_SESSION['entity_crud_hook_test'] = array();
+    $account = user_save($account, $edit);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_insert called for type user');
+    $this->assertHookMessage('entity_crud_hook_test_user_insert called');
+
+    $_SESSION['entity_crud_hook_test'] = array();
+    $account = user_load($account->uid);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_load called for type user');
+    $this->assertHookMessage('entity_crud_hook_test_user_load called');
+
+    $_SESSION['entity_crud_hook_test'] = array();
+    $edit['name'] = 'New name';
+    $account = user_save($account, $edit);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_update called for type user');
+    $this->assertHookMessage('entity_crud_hook_test_user_update called');
+
+    $_SESSION['entity_crud_hook_test'] = array();
+    user_delete($account->uid);
+
+    $this->assertHookMessage('entity_crud_hook_test_entity_delete called for type user');
+    $this->assertHookMessage('entity_crud_hook_test_user_delete called');
+  }
+
+}
Index: modules/system/system.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.api.php,v
retrieving revision 1.197
diff -u -p -r1.197 system.api.php
--- modules/system/system.api.php	2 Oct 2010 01:22:41 -0000	1.197
+++ modules/system/system.api.php	10 Oct 2010 15:34:17 -0000
@@ -284,6 +284,17 @@ function hook_entity_load($entities, $ty
  *   The type of entity being inserted (i.e. node, user, comment).
  */
 function hook_entity_insert($entity, $type) {
+  // Insert the new entity into a fictional table of all entities.
+  $info = entity_get_info($type);
+  $id = reset(entity_extract_ids($type, $entity));
+  db_insert('example_entity')
+    ->fields(array(
+      'type' => $type,
+      'id' => $id,
+      'created' => REQUEST_TIME,
+      'updated' => REQUEST_TIME,
+    ))
+    ->execute();
 }

 /**
@@ -295,6 +306,34 @@ function hook_entity_insert($entity, $ty
  *   The type of entity being updated (i.e. node, user, comment).
  */
 function hook_entity_update($entity, $type) {
+  // Update the entity's entry in a fictional table of all entities.
+  $info = entity_get_info($type);
+  $id = reset(entity_extract_ids($type, $entity));
+  db_update('example_entity')
+    ->fields(array(
+      'updated' => REQUEST_TIME,
+    ))
+    ->condition('type', $type)
+    ->condition('id', $id)
+    ->execute();
+}
+
+/**
+ * Act on entities when deleted.
+ *
+ * @param $entity
+ *   The entity object.
+ * @param $type
+ *   The type of entity being deleted (i.e. node, user, comment).
+ */
+function hook_entity_delete($entity, $type) {
+  // Delete the entity's entry from a fictional table of all entities.
+  $info = entity_get_info($type);
+  $id = reset(entity_extract_ids($type, $entity));
+  db_delete('example_entity')
+    ->condition('type', $type)
+    ->condition('id', $id)
+    ->execute();
 }

 /**
Index: modules/taxonomy/taxonomy.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v
retrieving revision 1.609
diff -u -p -r1.609 taxonomy.module
--- modules/taxonomy/taxonomy.module	3 Oct 2010 01:15:33 -0000	1.609
+++ modules/taxonomy/taxonomy.module	10 Oct 2010 15:34:19 -0000
@@ -425,7 +425,8 @@ function taxonomy_vocabulary_delete($vid
     ->execute();

   field_attach_delete_bundle('taxonomy_term', $vocabulary['machine_name']);
-  module_invoke_all('taxonomy', 'delete', 'vocabulary', $vocabulary);
+  module_invoke_all('taxonomy_vocabulary_delete', $vocabulary);
+  module_invoke_all('entity_delete', $vocabulary, 'taxonomy_vocabulary');

   cache_clear_all();
   entity_get_controller('taxonomy_vocabulary')->resetCache();
@@ -581,6 +582,7 @@ function taxonomy_term_delete($tid) {

         field_attach_delete('taxonomy_term', $term);
         module_invoke_all('taxonomy_term_delete', $term);
+        module_invoke_all('entity_delete', $term, 'taxonomy_term');
         taxonomy_terms_static_reset();
       }
     }
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.1207
diff -u -p -r1.1207 user.module
--- modules/user/user.module	8 Oct 2010 05:28:30 -0000	1.1207
+++ modules/user/user.module	10 Oct 2010 15:34:22 -0000
@@ -2343,6 +2343,7 @@ function user_delete_multiple(array $uid

     foreach ($accounts as $uid => $account) {
       module_invoke_all('user_delete', $account);
+      module_invoke_all('entity_delete', $account, 'user');
       field_attach_delete('user', $account);
       drupal_session_destroy_uid($account->uid);
     }
