Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.1088 diff -u -p -r1.1088 common.inc --- includes/common.inc 13 Jan 2010 13:03:26 -0000 1.1088 +++ includes/common.inc 14 Jan 2010 05:56:40 -0000 @@ -6346,7 +6346,8 @@ function entity_get_info($entity_type = 'bundles' => array(), 'view modes' => array(), 'object keys' => array(), - 'cacheable' => TRUE, + 'field cache' => TRUE, + 'entity cache' => FALSE, 'translation' => array(), ); $entity_info[$name]['object keys'] += array( @@ -6400,8 +6401,8 @@ function entity_extract_ids($entity_type // If no bundle key provided, then we assume a single bundle, named after the // entity type. $bundle = $info['object keys']['bundle'] ? $entity->{$info['object keys']['bundle']} : $entity_type; - $cacheable = $info['cacheable']; - return array($id, $vid, $bundle, $cacheable); + $field_cache = $info['field cache']; + return array($id, $vid, $bundle, $field_cache); } /** @@ -6466,7 +6467,7 @@ function entity_create_stub_entity($enti */ function entity_load($entity_type, $ids = array(), $conditions = array(), $reset = FALSE) { if ($reset) { - entity_get_controller($entity_type)->resetCache(); + entity_get_controller($entity_type)->clearCache($ids); } return entity_get_controller($entity_type)->load($ids, $conditions); } Index: includes/entity.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/entity.inc,v retrieving revision 1.4 diff -u -p -r1.4 entity.inc --- includes/entity.inc 8 Dec 2009 06:33:11 -0000 1.4 +++ includes/entity.inc 14 Jan 2010 05:56:40 -0000 @@ -24,7 +24,17 @@ interface DrupalEntityControllerInterfac /** * Reset the internal, static entity cache. */ - public function resetCache(); + public function resetStaticCache(); + + /** + * Clear the persistent cache for an entity. + * + * @param $ids + * A single entity ID or array of IDs, if present clear the entity cache for + * these specific entities. If no argument is given, the entire bin + * specified in hook_entity_info() will be flushed. + */ + public function clearCache($id = NULL); /** * Load one or more entities. @@ -48,7 +58,8 @@ interface DrupalEntityControllerInterfac */ class DrupalDefaultEntityController implements DrupalEntityControllerInterface { - protected $entityCache; + protected $entityStaticCache; + protected $entityPersistentCache; protected $entityType; protected $entityInfo; protected $hookLoadArguments; @@ -63,7 +74,7 @@ class DrupalDefaultEntityController impl public function __construct($entityType) { $this->entityType = $entityType; $this->entityInfo = entity_get_info($entityType); - $this->entityCache = array(); + $this->entityStaticCache = array(); $this->hookLoadArguments = array(); $this->idKey = $this->entityInfo['object keys']['id']; @@ -77,11 +88,38 @@ class DrupalDefaultEntityController impl } // Check if the entity type supports static caching of loaded entities. - $this->cache = !empty($this->entityInfo['static cache']); + $this->staticCache = !empty($this->entityInfo['static cache']); + // Check if the entity type supports persistent caching if loaded entities. + $this->persistentCache = !empty($this->entityInfo['entity cache']); + } + + public function resetStaticCache() { + $this->staticCache = array(); } - public function resetCache() { - $this->entityCache = array(); + public function clearCache($ids = NULL) { + // Only attempt to clear the persistent cache if this entity type uses it. + if ($this->persistentCache) { + // For consistency with cache_clear_all(), we allow either a single ID + // or an array of IDS. + if (isset($ids)) { + $ids = is_numeric($ids) ? array($ids) : $ids; + foreach ($ids as $id) { + $cids[] = $this->entityType . ':' . $id; + $wildcard = FALSE; + } + } + // If no IDs are given, do a full cache bin flush. + else { + $cids = '*'; + $wildcard = TRUE; + } + $bin = $this->entityInfo['entity cache bin']; + + cache_clear_all($cids, $bin, $wildcard); + } + // Clear the static cache whenever this is called. + $this->resetStaticCache(); } public function load($ids = array(), $conditions = array()) { @@ -108,17 +146,35 @@ class DrupalDefaultEntityController impl $passed_ids = !empty($this->ids) ? array_flip($this->ids) : FALSE; // Try to load entities from the static cache, if the entity type supports // static caching. - if ($this->cache) { - $entities += $this->cacheGet($this->ids, $this->conditions); + if ($this->staticCache) { + $entities += $this->staticCacheGet($this->ids, $this->conditions); // If any entities were loaded, remove them from the ids still to load. if ($passed_ids) { $this->ids = array_keys(array_diff_key($passed_ids, $entities)); } } + // Attempt to load any remaining entities from the persistent cache. + $cached_entities = array(); + + $cid_prefix = $this->entityType . ':'; + if ($this->persistentCache && $this->ids && !$this->conditions && !$this->revisionId) { + foreach ($this->ids as $id) { + $cids[] = $cid_prefix . $id; + } + if ($cached = cache_get_multiple($cids, $this->entityInfo['entity cache bin'])) { + foreach ($cached as $item) { + $id = str_replace($cid_prefix, '', $item->cid); + $cached_entities[$id] = $item->data; + } + $this->ids = array_diff($this->ids, array_keys($cached_entities)); + } + } + // Load any remaining entities from the database. This is the case if $ids // is set to FALSE (so we load all entities), if there are any ids left to // load, if loading a revision, or if $conditions was passed without $ids. + $queried_entities = array(); if ($this->ids === FALSE || $this->ids || $this->revisionId || ($this->conditions && !$passed_ids)) { // Build the query. $this->buildQuery(); @@ -132,15 +188,32 @@ class DrupalDefaultEntityController impl // entity type specific load callback, for example hook_node_load(). if (!empty($queried_entities)) { $this->attachLoad($queried_entities); - $entities += $queried_entities; + // If these entities can be persistently cached, do so now. + if ($this->persistentCache && !$this->revisionId) { + foreach ($queried_entities as $item) { + cache_set($cid_prefix . $item->{$this->idKey}, $item, $this->entityInfo['entity cache bin']); + } + } } - if ($this->cache) { - // Add entities to the cache if we are not loading a revision. - if (!empty($queried_entities) && !$this->revisionId) { - $this->cacheSet($queried_entities); + // Now that attachLoad() has been run, merge in entities loaded from cache + // and those from the database into a single variable. + $new_entities = $queried_entities + $cached_entities; + + // Allow modules to act on entities without the result being persistently + // cached. + if (!empty($new_entities)) { + $this->attachAfterLoad($new_entities); + if ($this->staticCache) { + // Add entities to the cache if we are not loading a revision. + if (!empty($new_entities) && !$this->revisionId) { + $this->staticCacheSet($new_entities); + } } } + // Merge all entities to be returned from this call into the same array + // now that all hooks have run. + $entities += $new_entities; // Ensure that the returned array is ordered the same as the original // $ids array if this was passed in and remove any invalid ids. @@ -257,6 +330,27 @@ class DrupalDefaultEntityController impl } /** + * Attach data to entities after loading. + * + * This calls hook_TYPE_load_uncached() to allow modules to interact with + * entity objects without the result being persistently cached. + * + * If your hook_TYPE_load() expects special parameters apart from the + * queried entities, you can set $this->hookLoadArguments prior to + * calling the method. See NodeController::attachLoad() for an example. + */ + protected function attachAfterLoad(&$entities) { + // Call hook_TYPE_load(). The first argument for hook_TYPE_load() is + // always the queried entities, followed by additional arguments set in + // $this->hookLoadArguments. + $args = array_merge(array($entities), $this->hookLoadArguments); + foreach (module_implements($this->entityInfo['load hook'] . '_uncached') as $module) { + call_user_func_array($module . '_' . $this->entityInfo['load hook'] . '_uncached', $args); + } + } + + + /** * Get entities from the static cache. * * @param $ids @@ -264,17 +358,17 @@ class DrupalDefaultEntityController impl * @param $conditions * If set, return entities that match all of these conditions. */ - protected function cacheGet($ids, $conditions = array()) { + protected function staticCacheGet($ids, $conditions = array()) { $entities = array(); // Load any available entities from the internal cache. - if (!empty($this->entityCache) && !$this->revisionId) { + if (!empty($this->entityStaticCache) && !$this->revisionId) { if ($ids) { - $entities += array_intersect_key($this->entityCache, array_flip($ids)); + $entities += array_intersect_key($this->entityStaticCache, array_flip($ids)); } // If loading entities only by conditions, fetch all available entities // from the cache. Entities which don't match are removed later. elseif ($conditions) { - $entities = $this->entityCache; + $entities = $this->entityStaticCache; } } @@ -294,7 +388,7 @@ class DrupalDefaultEntityController impl /** * Store entities in the static entity cache. */ - protected function cacheSet($entities) { - $this->entityCache += $entities; + protected function staticCacheSet($entities) { + $this->entityStaticCache += $entities; } } Index: includes/file.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/file.inc,v retrieving revision 1.200 diff -u -p -r1.200 file.inc --- includes/file.inc 30 Dec 2009 08:16:55 -0000 1.200 +++ includes/file.inc 14 Jan 2010 05:56:40 -0000 @@ -493,6 +493,7 @@ function file_save(stdClass $file) { drupal_write_record('file', $file, 'fid'); // Inform modules that the file has been updated. module_invoke_all('file_update', $file); + entity_get_controller('file')->clearCache($file->fid); } return $file; @@ -939,6 +940,7 @@ function file_delete(stdClass $file, $fo // Let other modules clean up any references to the deleted file. module_invoke_all('file_delete', $file); + entity_get_controller('file')->clearCache($file->fid); // 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/book/book.module =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.module,v retrieving revision 1.536 diff -u -p -r1.536 book.module --- modules/book/book.module 9 Jan 2010 21:54:00 -0000 1.536 +++ modules/book/book.module 14 Jan 2010 05:56:42 -0000 @@ -754,9 +754,9 @@ function book_menu_name($bid) { } /** - * Implements hook_node_load(). + * Implements hook_node_load_uncached(). */ -function book_node_load($nodes, $types) { +function book_node_load_uncached($nodes, $types) { $result = db_query("SELECT * FROM {book} b INNER JOIN {menu_links} ml ON b.mlid = ml.mlid WHERE b.nid IN (:nids)", array(':nids' => array_keys($nodes)), array('fetch' => PDO::FETCH_ASSOC)); foreach ($result as $record) { $nodes[$record['nid']]->book = $record; Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.837 diff -u -p -r1.837 comment.module --- modules/comment/comment.module 14 Jan 2010 02:00:08 -0000 1.837 +++ modules/comment/comment.module 14 Jan 2010 05:56:42 -0000 @@ -1372,6 +1372,7 @@ function comment_save($comment) { module_invoke_all('comment_update', $comment); // Add an entry to the watchdog log. watchdog('content', 'Comment: updated %subject.', array('%subject' => $comment->subject), WATCHDOG_NOTICE, l(t('view'), 'comment/' . $comment->cid, array('fragment' => 'comment-' . $comment->cid))); + entity_get_controller('comment')->clearCache($comment->cid); } else { // Add the comment to database. This next section builds the thread field. @@ -1502,6 +1503,7 @@ function comment_delete_multiple($cids) $child_cids = db_query('SELECT cid FROM {comment} WHERE pid = :cid', array(':cid' => $comment->cid))->fetchCol(); comment_delete_multiple($child_cids); _comment_update_node_statistics($comment->nid); + entity_get_controller('comment')->clearCache($comment->cid); } } } Index: modules/field/field.attach.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/field/field.attach.inc,v retrieving revision 1.72 diff -u -p -r1.72 field.attach.inc --- modules/field/field.attach.inc 12 Jan 2010 06:21:34 -0000 1.72 +++ modules/field/field.attach.inc 14 Jan 2010 05:56:42 -0000 @@ -540,7 +540,7 @@ function field_attach_load($obj_type, $o $info = entity_get_info($obj_type); // Only the most current revision of non-deleted fields for // cacheable fieldable types can be cached. - $cache_read = $load_current && $info['cacheable'] && empty($options['deleted']); + $cache_read = $load_current && $info['field cache'] && empty($options['deleted']); // In addition, do not write to the cache when loading a single field. $cache_write = $cache_read && !isset($options['field_id']); @@ -821,7 +821,7 @@ function field_attach_insert($obj_type, _field_invoke_default('insert', $obj_type, $object); _field_invoke('insert', $obj_type, $object); - list($id, $vid, $bundle, $cacheable) = entity_extract_ids($obj_type, $object); + list($id, $vid, $bundle, $field_cache) = entity_extract_ids($obj_type, $object); // Let any module insert field data before the storage engine, accumulating // saved fields along the way. @@ -854,7 +854,7 @@ function field_attach_insert($obj_type, // Let other modules act on inserting the object. module_invoke_all('field_attach_insert', $obj_type, $object); - if ($cacheable) { + if ($field_cache) { cache_clear_all("field:$obj_type:$id", 'cache_field'); } } @@ -870,7 +870,7 @@ function field_attach_insert($obj_type, function field_attach_update($obj_type, $object) { _field_invoke('update', $obj_type, $object); - list($id, $vid, $bundle, $cacheable) = entity_extract_ids($obj_type, $object); + list($id, $vid, $bundle, $field_cache) = entity_extract_ids($obj_type, $object); // Let any module update field data before the storage engine, accumulating // saved fields along the way. @@ -907,7 +907,7 @@ function field_attach_update($obj_type, // Let other modules act on updating the object. module_invoke_all('field_attach_update', $obj_type, $object); - if ($cacheable) { + if ($field_cache) { cache_clear_all("field:$obj_type:$id", 'cache_field'); } } Index: modules/field/tests/field_test.entity.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/field/tests/field_test.entity.inc,v retrieving revision 1.2 diff -u -p -r1.2 field_test.entity.inc --- modules/field/tests/field_test.entity.inc 26 Dec 2009 16:50:08 -0000 1.2 +++ modules/field/tests/field_test.entity.inc 14 Jan 2010 05:56:42 -0000 @@ -28,7 +28,7 @@ function field_test_entity_info() { 'revision' => 'ftvid', 'bundle' => 'fttype', ), - 'cacheable' => FALSE, + 'field cache' => FALSE, 'bundles' => $bundles, 'fieldable' => TRUE, 'view modes' => $test_entity_modes, @@ -42,7 +42,7 @@ function field_test_entity_info() { 'bundle' => 'fttype', ), 'fieldable' => TRUE, - 'cacheable' => TRUE, + 'field cache' => TRUE, 'bundles' => $bundles, 'view modes' => $test_entity_modes, ), Index: modules/forum/forum.test =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.test,v retrieving revision 1.46 diff -u -p -r1.46 forum.test --- modules/forum/forum.test 9 Jan 2010 23:09:51 -0000 1.46 +++ modules/forum/forum.test 14 Jan 2010 05:56:42 -0000 @@ -159,7 +159,7 @@ class ForumTestCase extends DrupalWebTes $this->assertRaw(t('Updated vocabulary %name.', array('%name' => $title)), t('Vocabulary was edited')); // Grab the newly edited vocabulary. - entity_get_controller('taxonomy_vocabulary')->resetCache(); + entity_get_controller('taxonomy_vocabulary')->clearCache(); $current_settings = taxonomy_vocabulary_load($vid); // Make sure we actually edited the vocabulary properly. Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.1212 diff -u -p -r1.1212 node.module --- modules/node/node.module 13 Jan 2010 12:58:47 -0000 1.1212 +++ modules/node/node.module 14 Jan 2010 05:56:43 -0000 @@ -1039,6 +1039,9 @@ function node_save($node) { // Update the node access table for this node. node_access_acquire_grants($node); + // Clear the entity cache. + entity_get_controller('node')->clearCache($node->nid); + // Clear internal properties. unset($node->is_new); @@ -1119,7 +1122,7 @@ function node_delete_multiple($nids) { // Clear the page and block and node_load_multiple caches. cache_clear_all(); - entity_get_controller('node')->resetCache(); + entity_get_controller('node')->clearCache($nids); } } @@ -3414,4 +3417,15 @@ class NodeController extends DrupalDefau $this->hookLoadArguments[] = array_keys($typed_nodes); parent::attachLoad($nodes); } + + protected function attachAfterLoad(&$nodes) { + // Create an array of content types and pass this to the + // object type specific callback. + $types = array(); + foreach ($nodes as $object) { + $types[$object->type] = $object->type; + } + $this->hookLoadArguments[] = $types; + parent::attachAfterLoad($nodes); + } } Index: modules/poll/poll.module =================================================================== RCS file: /cvs/drupal/drupal/modules/poll/poll.module,v retrieving revision 1.337 diff -u -p -r1.337 poll.module --- modules/poll/poll.module 13 Jan 2010 05:40:03 -0000 1.337 +++ modules/poll/poll.module 14 Jan 2010 05:56:44 -0000 @@ -464,7 +464,6 @@ function poll_node_prepare_translation($ * Implements hook_load(). */ function poll_load($nodes) { - global $user; foreach ($nodes as $node) { $poll = db_query("SELECT runtime, active FROM {poll} WHERE nid = :nid", array(':nid' => $node->nid))->fetchObject(); @@ -476,23 +475,6 @@ function poll_load($nodes) { ->orderBy('weight') ->execute()->fetchAllAssoc('chid', PDO::FETCH_ASSOC); - // Determine whether or not this user is allowed to vote. - $poll->allowvotes = FALSE; - if (user_access('vote on polls') && $poll->active) { - if ($user->uid) { - $result = db_query('SELECT chid FROM {poll_vote} WHERE nid = :nid AND uid = :uid', array(':nid' => $node->nid, ':uid' => $user->uid))->fetchObject(); - } - else { - $result = db_query("SELECT chid FROM {poll_vote} WHERE nid = :nid AND hostname = :hostname", array(':nid' => $node->nid, ':hostname' => ip_address()))->fetchObject(); - } - if ($result) { - $poll->vote = $result->chid; - } - else { - $poll->vote = -1; - $poll->allowvotes = TRUE; - } - } foreach ($poll as $key => $value) { $nodes[$node->nid]->$key = $value; } @@ -500,6 +482,39 @@ function poll_load($nodes) { } /** + * Implements hook_node_load_uncached(). + * + * Loads user-specific information into the node object for the duration + * of the page request only. + */ +function poll_node_load_uncached($nodes, $types) { + global $user; + + foreach ($nodes as $node) { + if ($node->type == 'poll') { + // Determine whether or not this user is allowed to vote. + $node->allowvotes = FALSE; + if (user_access('vote on polls') && $node->active) { + if ($user->uid) { + $result = db_query('SELECT chid FROM {poll_vote} WHERE nid = :nid AND uid = :uid', array(':nid' => $node->nid, ':uid' => $user->uid))->fetchObject(); + } + else { + $result = db_query("SELECT chid FROM {poll_vote} WHERE nid = :nid AND hostname = :hostname", array(':nid' => $node->nid, ':hostname' => ip_address()))->fetchObject(); + } + if ($result) { + $node->vote = $result->chid; + } + else { + $node->vote = -1; + $node->allowvotes = TRUE; + } + } + } + } +} + + +/** * Implements hook_insert(). */ function poll_insert($node) { @@ -730,6 +745,7 @@ function poll_vote($form, &$form_state) ->condition('chid', $choice) ->execute(); + entity_get_controller('node')->clearCache($node->nid); cache_clear_all(); drupal_set_message(t('Your vote was recorded.')); Index: modules/taxonomy/taxonomy.module =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v retrieving revision 1.565 diff -u -p -r1.565 taxonomy.module --- modules/taxonomy/taxonomy.module 13 Jan 2010 23:19:54 -0000 1.565 +++ modules/taxonomy/taxonomy.module 14 Jan 2010 05:56:44 -0000 @@ -338,6 +338,7 @@ function taxonomy_vocabulary_save($vocab if (!empty($vocabulary->vid) && !empty($vocabulary->name)) { $status = drupal_write_record('taxonomy_vocabulary', $vocabulary, 'vid'); module_invoke_all('taxonomy_vocabulary_update', $vocabulary); + entity_get_controller('taxonomy_vocabulary')->clearCache($vocabulary->vid); } elseif (empty($vocabulary->vid)) { $status = drupal_write_record('taxonomy_vocabulary', $vocabulary); @@ -347,7 +348,6 @@ function taxonomy_vocabulary_save($vocab } cache_clear_all(); - entity_get_controller('taxonomy_vocabulary')->resetCache(); return $status; } @@ -375,7 +375,7 @@ function taxonomy_vocabulary_delete($vid module_invoke_all('taxonomy', 'delete', 'vocabulary', $vocabulary); cache_clear_all(); - entity_get_controller('taxonomy_vocabulary')->resetCache(); + entity_get_controller('taxonomy_vocabulary')->clearCache(); return SAVED_DELETED; } @@ -470,10 +470,11 @@ function taxonomy_term_save($term) { $status = drupal_write_record('taxonomy_term_data', $term, 'tid'); field_attach_update('taxonomy_term', $term); module_invoke_all('taxonomy_term_update', $term); + entity_get_controller('taxonomy_term')->clearCache($term->tid); + taxonomy_terms_static_reset(); } else { $status = drupal_write_record('taxonomy_term_data', $term); - _taxonomy_clean_field_cache($term); field_attach_insert('taxonomy_term', $term); module_invoke_all('taxonomy_term_insert', $term); } @@ -511,7 +512,6 @@ function taxonomy_term_save($term) { $query->execute(); cache_clear_all(); - taxonomy_terms_static_reset(); return $status; } @@ -550,15 +550,15 @@ function taxonomy_term_delete($tid) { ->execute(); field_attach_delete('taxonomy_term', $term); - _taxonomy_clean_field_cache($term); module_invoke_all('taxonomy_term_delete', $term); } $tids = $orphans; } - cache_clear_all(); + entity_get_controller('taxonomy_term')->clearCache($term->tid); taxonomy_terms_static_reset(); + cache_clear_all(); return SAVED_DELETED; } @@ -571,7 +571,7 @@ function taxonomy_terms_static_reset() { drupal_static_reset('taxonomy_get_tree'); drupal_static_reset('taxonomy_get_parents'); drupal_static_reset('taxonomy_get_children'); - entity_get_controller('taxonomy_term')->resetCache(); + entity_get_controller('taxonomy_term')->clearCache(); } /** @@ -1181,48 +1181,6 @@ function taxonomy_field_formatter_prepar } /** - * Helper function that clears field cache when terms are updated or deleted - */ -function _taxonomy_clean_field_cache($term) { - $cids = array(); - - // Determine object types that are not cacheable. - $obj_types = array(); - foreach (entity_get_info() as $obj_type => $info) { - if (isset($info['cacheable']) && !$info['cacheable']) { - $obj_types[] = $obj_type; - } - } - - // Load info for all taxonomy term fields. - $fields = field_read_fields(array('type' => 'taxonomy_term_reference')); - foreach ($fields as $field_name => $field) { - - // Assemble an array of vocabulary IDs that are used in this field. - foreach ($field['settings']['allowed_values'] as $tree) { - $vids[$tree['vid']] = $tree['vid']; - } - - // Check this term's vocabulary against those used for the field's options. - if (in_array($term->vid, $vids)) { - $conditions = array(array('tid', $term->tid)); - if ($obj_types) { - $conditions[] = array('type', $obj_types, 'NOT IN'); - } - $results = field_attach_query($field['id'], $conditions, array('limit' => FIELD_QUERY_NO_LIMIT)); - foreach ($results as $obj_type => $objects) { - foreach (array_keys($objects) as $id) { - $cids[] = "field:$obj_type:$id"; - } - } - } - } - if ($cids) { - cache_clear_all($cids, 'cache_field'); - } -} - -/** * Title callback for term pages. * * @param $term Index: modules/taxonomy/taxonomy.test =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.test,v retrieving revision 1.68 diff -u -p -r1.68 taxonomy.test --- modules/taxonomy/taxonomy.test 10 Jan 2010 22:56:51 -0000 1.68 +++ modules/taxonomy/taxonomy.test 14 Jan 2010 05:56:44 -0000 @@ -156,7 +156,7 @@ class TaxonomyVocabularyFunctionalTest e // Check the created vocabulary. $vocabularies = taxonomy_get_vocabularies(); $vid = $vocabularies[count($vocabularies)-1]->vid; - entity_get_controller('taxonomy_vocabulary')->resetCache(); + entity_get_controller('taxonomy_vocabulary')->clearCache(); $vocabulary = taxonomy_vocabulary_load($vid); $this->assertTrue($vocabulary, t('Vocabulary found in database')); @@ -169,7 +169,7 @@ class TaxonomyVocabularyFunctionalTest e // Confirm deletion. $this->drupalPost(NULL, NULL, t('Delete')); $this->assertRaw(t('Deleted vocabulary %name.', array('%name' => $vocabulary->name)), t('Vocabulary deleted')); - entity_get_controller('taxonomy_vocabulary')->resetCache(); + entity_get_controller('taxonomy_vocabulary')->clearCache(); $this->assertFalse(taxonomy_vocabulary_load($vid), t('Vocabulary is not found in the database')); } } @@ -683,6 +683,7 @@ class TaxonomyHooksTestCase extends Taxo 'antonym' => 'Short', ); $this->drupalPost('taxonomy/term/' . $term->tid . '/edit', $edit, t('Save')); + entity_get_controller('taxonomy_term')->clearCache($term->tid); taxonomy_terms_static_reset(); $term = taxonomy_term_load($term->tid); $this->assertEqual($edit['antonym'], $term->antonym, t('Antonym was successfully edited'));