Browse Source

Add force option to app install command

Signed-off-by: Maxopoly <max@dermax.org>
pull/26252/head
Maxopoly 5 years ago
parent
commit
1f93721097
  1. 9
      core/Command/App/Install.php

9
core/Command/App/Install.php

@ -50,11 +50,18 @@ class Install extends Command {
InputOption::VALUE_NONE, InputOption::VALUE_NONE,
'don\'t enable the app afterwards' 'don\'t enable the app afterwards'
) )
->addOption(
'force',
'f',
InputOption::VALUE_NONE,
'install the app regardless of the Nextcloud version requirement'
)
; ;
} }
protected function execute(InputInterface $input, OutputInterface $output): int { protected function execute(InputInterface $input, OutputInterface $output): int {
$appId = $input->getArgument('app-id'); $appId = $input->getArgument('app-id');
$forceEnable = (bool) $input->getOption('force');
if (\OC_App::getAppPath($appId)) { if (\OC_App::getAppPath($appId)) {
$output->writeln($appId . ' already installed'); $output->writeln($appId . ' already installed');
@ -65,7 +72,7 @@ class Install extends Command {
/** @var Installer $installer */ /** @var Installer $installer */
$installer = \OC::$server->query(Installer::class); $installer = \OC::$server->query(Installer::class);
$installer->downloadApp($appId); $installer->downloadApp($appId);
$result = $installer->installApp($appId);
$result = $installer->installApp($appId, $forceEnable);
} catch (\Exception $e) { } catch (\Exception $e) {
$output->writeln('Error: ' . $e->getMessage()); $output->writeln('Error: ' . $e->getMessage());
return 1; return 1;

Loading…
Cancel
Save