summaryrefslogtreecommitdiffstats
path: root/core/Command
diff options
context:
space:
mode:
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);