Skip to content

Commit

Permalink
Allow dependencies of parent profiles to be uninstalled (#3525)
Browse files Browse the repository at this point in the history
  • Loading branch information
balsama authored and jmolivas committed Oct 28, 2017
1 parent decc9db commit cb02dc9
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/Command/Module/UninstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,22 @@ protected function execute(InputInterface $input, OutputInterface $output)
}

if (!$force = $input->getOption('force')) {
$profile = drupal_get_profile();

// Get a list of installed profiles that will be excluded when calculating
// the dependency tree.
if (\Drupal::hasService('profile_handler')) {
// #1356276 adds the profile_handler service but it hasn't been committed
// to core yet so we need to check if it exists.
$profiles = \Drupal::service('profile_handler')->getProfileInheritance();
}
else {
$profiles[drupal_get_profile()] = [];
}

$dependencies = [];
while (list($module) = each($moduleList)) {
foreach (array_keys($moduleData[$module]->required_by) as $dependency) {
if (isset($installedModules[$dependency]) && !isset($moduleList[$dependency]) && $dependency != $profile) {
if (isset($installedModules[$dependency]) && !isset($moduleList[$dependency]) && (!array_key_exists($dependency, $profiles))) {
$dependencies[] = $dependency;
}
}
Expand Down

0 comments on commit cb02dc9

Please sign in to comment.