From f8771d3d810b521f83f4c955d62b4c2f4b10cdfc Mon Sep 17 00:00:00 2001 From: Patrik Kernstock Date: Fri, 5 Oct 2018 12:49:34 +0200 Subject: Run uninstall tasks by default, added '--keep-data' parameter Signed-off-by: Patrik Kernstock --- core/Command/App/Remove.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'core/Command') diff --git a/core/Command/App/Remove.php b/core/Command/App/Remove.php index 5b4e29911ca..75d3cac6b04 100644 --- a/core/Command/App/Remove.php +++ b/core/Command/App/Remove.php @@ -27,6 +27,7 @@ use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareI use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -40,6 +41,12 @@ class Remove extends Command implements CompletionAwareInterface { 'app-id', InputArgument::REQUIRED, 'remove the specified app' + ) + ->addOption( + 'keep-data', + null, + InputOption::VALUE_NONE, + 'keep app data and do not remove them' ); } @@ -51,6 +58,18 @@ class Remove extends Command implements CompletionAwareInterface { return 1; } + if (!$input->getOption('keep-data')) { + try { + /** @var IAppManager $appManager*/ + $appManager = \OC::$server->getAppManager(); + $appManager->disableApp($appId); + $output->writeln($appId . ' disabled'); + } catch(\Exception $e) { + $output->writeln('Error: ' . $e->getMessage()); + return 1; + } + } + try { /** @var Installer $installer */ $installer = \OC::$server->query(Installer::class); -- cgit v1.2.3