function entity_entitycache_installed_modules

7.x entity.install entity_entitycache_installed_modules($modules = NULL)

Create cache tables for entities of modules that support Entity cache module.


$modules: (optional) An array of module names that have been installed. If not specified, try to add cache tables for all modules.

3 calls to entity_entitycache_installed_modules()
entity_enable in entity/entity.install
Implements hook_enable().
entity_modules_installed in entity/entity.module
Implements hook_modules_installed().
entity_update_7003 in entity/entity.install
Create cache tables for entities that support Entity cache module.


entity/entity.install, line 52
Install file for the entity API.


function entity_entitycache_installed_modules($modules = NULL) {
  if (!module_exists('entitycache')) {

  // If no modules are specified or if entitycache is being installed,
  // try to add entitycache tables for supporting entities of all modules.
  if (!isset($modules) || in_array('entitycache', $modules)) {
    $modules = module_list();

  // Get all installed modules that support entity cache.
  $entitycache_module_info = _entity_entitycache_get_module_info($modules);

  // For uninstallation of modules, we need to keep a list of tables we created
  // per module providing the entity type.
  $tables_created = variable_get('entity_cache_tables_created');

  foreach ($entitycache_module_info as $module => $module_entitycache_entities) {
    foreach ($module_entitycache_entities as $entity_type => $entity_info) {
      // Do not break modules that create the cache tables for themselves.
      if (!db_table_exists('cache_entity_' . $entity_type)) {
        $schema = drupal_get_schema_unprocessed('system', 'cache');
        $schema['description'] = 'Cache table used to store' . $entity_type . ' entity records.';
        db_create_table('cache_entity_' . $entity_type, $schema);
        $tables_created[$module][] = 'cache_entity_' . $entity_type;
  variable_set('entity_cache_tables_created', $tables_created);