aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2019-12-16 12:34:27 +0100
committerGitHub <noreply@github.com>2019-12-16 12:34:27 +0100
commitfaf58e4cacf6475110e32c7e5c8f37971b641b1a (patch)
tree8d9e184401c781e1b4c95d2b369e17ef0b448f61 /core
parent85ef2bf94429d37ad4c76860b8d9028505b3bf13 (diff)
parent3eee359d7ffd6219f6a2ab8cca18a13118552842 (diff)
downloadnextcloud-server-faf58e4cacf6475110e32c7e5c8f37971b641b1a.tar.gz
nextcloud-server-faf58e4cacf6475110e32c7e5c8f37971b641b1a.zip
Merge pull request #17018 from nextcloud/feature/noid/allow-to-force-enable-via-cli
Allow to force enable apps via CLI
Diffstat (limited to 'core')
-rw-r--r--core/Command/App/Enable.php18
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) {