Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Run uninstall tasks by default, added '--keep-data' parameter
Signed-off-by: Patrik Kernstock <info@pkern.at>
  • Loading branch information
patschi committed Oct 5, 2018
commit f8771d3d810b521f83f4c955d62b4c2f4b10cdfc
19 changes: 19 additions & 0 deletions core/Command/App/Remove.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
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;

Expand All @@ -40,6 +41,12 @@ protected function configure() {
'app-id',
InputArgument::REQUIRED,
'remove the specified app'
)
->addOption(
'keep-data',
null,
InputOption::VALUE_NONE,
'keep app data and do not remove them'
);
}

Expand All @@ -51,6 +58,18 @@ protected function execute(InputInterface $input, OutputInterface $output) {
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);
Expand Down