mirror of
https://github.com/nextcloud/server.git
synced 2026-04-22 14:50:17 -04:00
Merge pull request #56419 from nextcloud/fix/provide-non-interactive-mode-to-run-encryption
fix: support -n option to encrypt-all command to allow to run in non-interactive mode
This commit is contained in:
commit
fbff470d4c
2 changed files with 8 additions and 3 deletions
|
|
@ -278,7 +278,7 @@ class EncryptAll {
|
|||
$this->writePasswordsToFile($newPasswords);
|
||||
|
||||
$this->output->writeln('');
|
||||
$question = new ConfirmationQuestion('Do you want to send the passwords directly to the users by mail? (y/n) ', false);
|
||||
$question = new ConfirmationQuestion('Do you want to send the passwords directly to the users by mail? (y/n) ', true);
|
||||
if ($this->questionHelper->ask($this->input, $this->output, $question)) {
|
||||
$this->sendPasswordsByMail();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,8 +58,11 @@ class EncryptAll extends Command {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||
if (!$input->isInteractive()) {
|
||||
if (!$input->isInteractive() && !$input->getOption('no-interaction')) {
|
||||
$output->writeln('Invalid TTY.');
|
||||
$output->writeln('If you are trying to execute the command in a Docker ');
|
||||
$output->writeln("container, do not forget to execute 'docker exec' with");
|
||||
|
|
@ -83,8 +86,9 @@ class EncryptAll extends Command {
|
|||
$output->writeln('Please ensure that no user accesses their files during this time!');
|
||||
$output->writeln('Note: The encryption module you use determines which files get encrypted.');
|
||||
$output->writeln('');
|
||||
$question = new ConfirmationQuestion('Do you really want to continue? (y/n) ', false);
|
||||
$question = new ConfirmationQuestion('Do you really want to continue? (y/n) ', true);
|
||||
if ($this->questionHelper->ask($input, $output, $question)) {
|
||||
//run encryption with the answer yes in interactive mode
|
||||
$this->forceMaintenanceAndTrashbin();
|
||||
|
||||
try {
|
||||
|
|
@ -98,6 +102,7 @@ class EncryptAll extends Command {
|
|||
$this->resetMaintenanceAndTrashbin();
|
||||
return self::SUCCESS;
|
||||
}
|
||||
//abort on no in interactive mode
|
||||
$output->writeln('aborted');
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue