From 2b6a75ebe4bfbc84362e74954a0b0f4947cdc933 Mon Sep 17 00:00:00 2001 From: Eric Bremner <ebremner@uwaterloo.ca> Date: Wed, 8 Jun 2022 14:27:52 -0400 Subject: [PATCH] ISTWCMS-5605: adding drush command for migration clean up --- src/Commands/UwDrushCommands.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/Commands/UwDrushCommands.php b/src/Commands/UwDrushCommands.php index 72546483..67f6152e 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); + } + } + } + } -- GitLab