Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-09-05 13:55:24 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2019-12-13 15:06:12 +0300
commit3eee359d7ffd6219f6a2ab8cca18a13118552842 (patch)
tree94aa2317588ce3864a3d3715330c757f61d25713 /core/Command
parent642606754b133a36d7715b45b243155cbb006f95 (diff)
Allow to force enable apps via CLI
Co-authored-by: Christoph Wurst <christoph@winzerhof-wurst.at> Signed-off-by: Joas Schilling <coding@schilljs.com> Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core/Command')
-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) {