diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/Command/App/Enable.php | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/core/Command/App/Enable.php b/core/Command/App/Enable.php index 6e91ae430ad..c4e2363def5 100644 --- a/core/Command/App/Enable.php +++ b/core/Command/App/Enable.php @@ -73,15 +73,22 @@ class Enable extends Command implements CompletionAwareInterface { 'g', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'enable the app only for a list of groups' + ) + ->addOption( + 'force', + 'f', + InputOption::VALUE_NONE, + 'enable the app regardless of the Nextcloud version requirement' ); } protected function execute(InputInterface $input, OutputInterface $output) { $appIds = $input->getArgument('app-id'); $groups = $this->resolveGroupIds($input->getOption('groups')); + $forceEnable = (bool) $input->getOption('force'); foreach ($appIds as $appId) { - $this->enableApp($appId, $groups, $output); + $this->enableApp($appId, $groups, $forceEnable, $output); } return $this->exitCode; @@ -90,9 +97,10 @@ class Enable extends Command implements CompletionAwareInterface { /** * @param string $appId * @param array $groupIds + * @param bool $forceEnable * @param OutputInterface $output */ - private function enableApp(string $appId, array $groupIds, OutputInterface $output): void { + private function enableApp(string $appId, array $groupIds, bool $forceEnable, OutputInterface $output): void { $groupNames = array_map(function (IGroup $group) { return $group->getDisplayName(); }, $groupIds); @@ -106,13 +114,13 @@ class Enable extends Command implements CompletionAwareInterface { $installer->downloadApp($appId); } - $installer->installApp($appId); + $installer->installApp($appId, $forceEnable); if ($groupIds === []) { - $this->appManager->enableApp($appId); + $this->appManager->enableApp($appId, $forceEnable); $output->writeln($appId . ' enabled'); } else { - $this->appManager->enableAppForGroups($appId, $groupIds); + $this->appManager->enableAppForGroups($appId, $groupIds, $forceEnable); $output->writeln($appId . ' enabled for groups: ' . implode(', ', $groupNames)); } } catch (AppPathNotFoundException $e) { |