123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- <?php
- function entity_enable() {
-
- entity_entitycache_installed_modules();
- }
- function entity_uninstall() {
-
- variable_del('entity_rebuild_on_flush');
- }
- function entity_update_7000() {
-
-
- }
- function entity_update_7001() {
- variable_del('entity_defaults_built');
- }
- function entity_update_7002() {
-
- }
- function entity_update_7003() {
- entity_entitycache_installed_modules();
- }
- function entity_entitycache_installed_modules($modules = NULL) {
- if (!module_exists('entitycache')) {
- return;
- }
-
-
- if (!isset($modules) || in_array('entitycache', $modules)) {
- $modules = module_list();
- }
-
- $entitycache_module_info = _entity_entitycache_get_module_info($modules);
-
-
- $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) {
-
- 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);
- }
- function entity_entitycache_uninstalled_modules($modules = NULL) {
-
-
- 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);
- }
- function _entity_entitycache_get_module_info($modules) {
-
-
- $entity_crud_info = entity_crud_get_info();
- $info = array();
- foreach ($entity_crud_info as $entity_name => $entity_info) {
-
- if (!isset($entity_info['module']) || empty($entity_info['entity cache'])) {
- continue;
- }
- $module = $entity_info['module'];
-
- if (!in_array($module, $modules)) {
- continue;
- }
-
- if (!isset($info[$module])) {
- $info[$module] = array();
- }
- $info[$module][$entity_name] = $entity_info;
- }
- return $info;
- }
|