#642612 by yched: Add clean way to reset entity_info() cache.
parent
37339758d1
commit
d3de3672f1
|
|
@ -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.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue