summaryrefslogtreecommitdiffstats
path: root/core/Command
diff options
context:
space:
mode:
authorPatrik Kernstock <info@pkern.at>2018-10-05 12:49:34 +0200
committerPatrik Kernstock <info@pkern.at>2018-10-05 12:49:34 +0200
commitf8771d3d810b521f83f4c955d62b4c2f4b10cdfc (patch)
treecf1d27119fad3bc1fc2e8e9f777da22a1b4d3990 /core/Command
parentc73363c3abbb24da4b0c0c4025b27880dad0017a (diff)
downloadnextcloud-server-f8771d3d810b521f83f4c955d62b4c2f4b10cdfc.tar.gz
nextcloud-server-f8771d3d810b521f83f4c955d62b4c2f4b10cdfc.zip
Run uninstall tasks by default, added '--keep-data' parameter
Signed-off-by: Patrik Kernstock <info@pkern.at>
Diffstat (limited to 'core/Command')
-rw-r--r--core/Command/App/Remove.php19
1 files changed, 19 insertions, 0 deletions
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);