You are here

function entity_flush_caches in Entity API 7

Implements hook_flush_caches().

File

./entity.module, line 1088

Code

function entity_flush_caches() {
  entity_property_info_cache_clear();

  // Re-build defaults in code, however skip it on the admin modules page. In
  // case of enabling or disabling modules we already rebuild defaults in
  // entity_modules_enabled() and entity_modules_disabled(), so we do not need
  // to do it again.
  // Also check if rebuilding on cache flush is explicitly disabled.
  if (current_path() != 'admin/modules/list/confirm' && variable_get('entity_rebuild_on_flush', TRUE)) {
    entity_defaults_rebuild();
  }

  // Care about entitycache tables.
  if (module_exists('entitycache')) {
    $tables = array();
    $tables_created = variable_get('entity_cache_tables_created');
    if (is_array($tables_created)) {
      foreach ($tables_created as $module => $entity_cache_tables) {
        $tables = array_merge($tables, $entity_cache_tables);
      }
    }
    return $tables;
  }
}