You are here

function entity_entitycache_uninstalled_modules in Entity API 7

Remove entity cache tables for entity types of uninstalled modules.

Parameters

$modules: (optional) An array of uninstalled modules. If not specified, try to remove cache tables for all modules.

1 call to entity_entitycache_uninstalled_modules()
entity_modules_uninstalled in ./entity.module
Implements hook_modules_uninstalled().

File

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

Code

function entity_entitycache_uninstalled_modules($modules = NULL) {

  // If no modules are specified or if entitycache is being uninstalled,
  // try to remove entitycache tables for supporting entities of all modules.
  if (!isset($modules) || in_array('entitycache', $modules)) {
    $modules = module_list();
  }
  $tables_created = variable_get('entity_cache_tables_created');
  foreach ($modules as $module) {
    if (!empty($tables_created[$module])) {
      foreach ($tables_created[$module] as $table) {
        db_drop_table($table);
      }
      unset($tables_created[$module]);
    }
  }
  variable_set('entity_cache_tables_created', $tables_created);
}