diff --git a/src/Commands/UwDrushCommands.php b/src/Commands/UwDrushCommands.php index 725464834c454924a071e8289612b3a27ed6449b..67f6152e5c1fe0359e2753236d24eba7e59358b0 100644 --- a/src/Commands/UwDrushCommands.php +++ b/src/Commands/UwDrushCommands.php @@ -227,4 +227,36 @@ class UwDrushCommands extends DrushCommands { return $path; } + /** + * Drush command to cleanup after a migration. + * + * @command mim:cleanup + * @aliases mimcu + * @usage mimcu + */ + public function migrationCleanUp() { + + // Modules to uninstall. + $modules = [ + 'uw_migrate', + 'webform_migrate', + 'webform_node' + ]; + + // Step through each of the modules, ensure that they + // are enabled, and if enabled, uninstall. + foreach ($modules as $module) { + + // If the module is enabled, uninstall it. + if (\Drupal::service('module_handler')->moduleExists($module)) { + + // Uninstall the module. + \Drupal::service('module_installer')->uninstall([$module]); + + // Log to the screen. + $this->logger()->success('Uninstalled: ' . $module); + } + } + } + }