Permalink
Browse files

Issue #1854: Allow uninstall of dependent modules. (#2566)

* Issue #1854: Allow uninstall of dependent modules.

* Updated documentation.

* List all modules to be uninstalled.
  • Loading branch information...
1 parent 997aa48 commit f7167cc0f1056dc9c2296c2a4528758d35d09f06 @danepowell danepowell committed with weitzman Feb 14, 2017
Showing with 5 additions and 9 deletions.
  1. +4 −8 commands/core/drupal/pm_8.inc
  2. +1 −1 commands/pm/pm.drush.inc
@@ -43,16 +43,13 @@ function _drush_pm_uninstall($extensions) {
drush_log(dt('!extension is already uninstalled.', array('!extension' => $extension)), LogLevel::OK);
}
elseif (drush_extension_get_type($extension_info[$extension]) == 'module') {
- $dependents = array();
+ // Add installed dependencies to the list of modules to uninstall.
foreach (drush_module_dependents(array($extension), $extension_info) as $dependent) {
- if (!in_array($dependent, $required) && ($extension_info[$dependent]->status)) {
- $dependents[] = $dependent;
+ // Check if this dependency is not required, already enabled, and not already already in the list of modules to uninstall.
+ if (!in_array($dependent, $required) && ($extension_info[$dependent]->status) && !in_array($dependent, $extensions)) {
+ $extensions[] = $dependent;
}
}
- if (count($dependents)) {
- drush_log(dt('To uninstall !extension, the following extensions must be uninstalled first: !required', array('!extension' => $extension, '!required' => implode(', ', $dependents))), LogLevel::ERROR);
- unset($extensions[$extension]);
- }
}
}
@@ -87,4 +84,3 @@ function _drush_pm_uninstall($extensions) {
drush_log(dt('!extension was successfully uninstalled.', array('!extension' => $extension)), LogLevel::OK);
}
}
-
@@ -290,7 +290,7 @@ function pm_drush_command() {
// 'description' => 'Download and enable one or more modules',
// );
$items['pm-uninstall'] = array(
- 'description' => 'Uninstall one or more modules.',
+ 'description' => 'Uninstall one or more modules and their dependent modules.',
'arguments' => array(
'modules' => 'A list of modules.',
),

0 comments on commit f7167cc

Please sign in to comment.