diff --git a/includes/common.inc b/includes/common.inc index 22d58488d585..e22ce998ac27 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -6278,6 +6278,14 @@ function entity_get_info($entity_type = NULL) { return empty($entity_type) ? $entity_info : $entity_info[$entity_type]; } +/** + * Resets the cached information about entity types. + */ +function entity_info_cache_clear() { + drupal_static_reset('entity_get_info'); + cache_clear_all('entity_info', 'cache'); +} + /** * Helper function to extract id, vid, and bundle name from an entity. * diff --git a/modules/field/field.info.inc b/modules/field/field.info.inc index ef6276415e5b..366a009eb337 100644 --- a/modules/field/field.info.inc +++ b/modules/field/field.info.inc @@ -26,8 +26,7 @@ function field_info_cache_clear() { // @todo: Remove this when field_attach_*_bundle() bundle management // functions are moved to the entity API. - drupal_static_reset('entity_get_info'); - cache_clear_all('entity_info', 'cache'); + entity_info_cache_clear(); _field_info_collate_types(TRUE); drupal_static_reset('field_build_modes'); diff --git a/modules/field/tests/field_test.module b/modules/field/tests/field_test.module index dd85c172961b..b8b07b96c9ec 100644 --- a/modules/field/tests/field_test.module +++ b/modules/field/tests/field_test.module @@ -105,8 +105,7 @@ function field_test_entity_info_translatable($obj_type = NULL, $translatable = N $stored_value = &drupal_static(__FUNCTION__, array()); if (isset($obj_type)) { $stored_value[$obj_type] = $translatable; - drupal_static_reset('entity_get_info'); - cache_clear_all('entity_info', 'cache'); + entity_info_cache_clear(); } return $stored_value; } diff --git a/modules/rdf/rdf.module b/modules/rdf/rdf.module index 7425feeb25c6..1ca95f6b6dd4 100644 --- a/modules/rdf/rdf.module +++ b/modules/rdf/rdf.module @@ -163,8 +163,7 @@ function rdf_mapping_save(&$mapping) { )) ->execute(); - cache_clear_all('entity_info', 'cache'); - drupal_static_reset('entity_get_info'); + entity_info_cache_clear(); return $status; } @@ -258,8 +257,7 @@ function rdf_rdfa_attributes($mapping, $data = NULL) { function rdf_modules_installed($modules) { // We need to clear the caches of entity_info as this is not done right // during the tests. see http://drupal.org/node/594234 - cache_clear_all('entity_info', 'cache'); - drupal_static_reset('entity_get_info'); + entity_info_cache_clear(); foreach ($modules as $module) { $function = $module . '_rdf_mapping'; diff --git a/modules/rdf/rdf.test b/modules/rdf/rdf.test index 3055a4cd5b7c..242f423992ff 100644 --- a/modules/rdf/rdf.test +++ b/modules/rdf/rdf.test @@ -138,8 +138,7 @@ class RdfMappingDefinitionTestCase extends DrupalWebTestCase { rdf_modules_installed(array('rdf_test', 'node')); // entity_info caches must be cleared during testing. This is done // automatically during the manual installation. - cache_clear_all('entity_info', 'cache'); - drupal_static_reset('entity_get_info'); + entity_info_cache_clear(); } /** diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc index 80e9c0bead65..90930c29865f 100644 --- a/modules/system/system.admin.inc +++ b/modules/system/system.admin.inc @@ -1055,7 +1055,7 @@ function system_modules_submit($form, &$form_state) { node_types_rebuild(); menu_rebuild(); cache_clear_all('schema', 'cache'); - cache_clear_all('entity_info', 'cache'); + entity_info_cache_clear(); drupal_clear_css_cache(); drupal_clear_js_cache();