diff --git a/core/modules/entity/entity.module b/core/modules/entity/entity.module index 8be942a..946b2d1 100644 --- a/core/modules/entity/entity.module +++ b/core/modules/entity/entity.module @@ -145,23 +145,30 @@ function entity_module_preuninstall($module) { } } - $schema = \Drupal::database()->schema(); - $storages = array(); - foreach ($definitions as $entity_type_id => $entity_type) { if ($entity_type->getProvider() == $module) { // Remove entity tables. $storage = $entity_manager->getStorage($entity_type_id); if ($storage instanceof ContentEntitySchemaHandlerInterface) { foreach ($storage->getSchema() as $table_name => $table_schema) { - if ($schema->tableExists($table_name)) { - $schema->dropTable($table_name); - $storages[$entity_type_id] = $storage; - } + $GLOBALS['entity_schema_uninstall']['storages'][$entity_type_id] = $storage; + $GLOBALS['entity_schema_uninstall']['tables'][] = $table_name; } } } } +} + - \Drupal::moduleHandler()->invokeAll('entity_schema_uninstalled', array($storages)); +/** + * Implements hook_modules_uninstalled(). + */ +function entity_modules_uninstalled($modules) { + $schema = \Drupal::database()->schema(); + foreach ($GLOBALS['entity_schema_uninstall']['tables'] as $table_name) { + if ($schema->tableExists($table_name)) { + $schema->dropTable($table_name); + } + } + \Drupal::moduleHandler()->invokeAll('entity_schema_uninstalled', array($GLOBALS['entity_schema_uninstall']['storages'])); }