Merge pull request #10439 from eugulixes/improve-encrypt-all-and-decrypt-all-commands
Check if TTY is invalid in encryption:encrypt-all and encryption:decrypt-all
This commit is contained in:
commit
e36d4a990d
4 changed files with 22 additions and 0 deletions
|
@ -123,6 +123,14 @@ class DecryptAll extends Command {
|
|||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
||||
if ( !$input->isInteractive() ) {
|
||||
$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");
|
||||
$output->writeln("the '-i' and '-t' options.");
|
||||
$output->writeln('');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if ($this->encryptionManager->isEnabled() === true) {
|
||||
|
|
|
@ -105,6 +105,14 @@ class EncryptAll extends Command {
|
|||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
||||
if ( !$input->isInteractive() ) {
|
||||
$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");
|
||||
$output->writeln("the '-i' and '-t' options.");
|
||||
$output->writeln('');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->encryptionManager->isEnabled() === false) {
|
||||
throw new \Exception('Server side encryption is not enabled');
|
||||
|
|
|
@ -73,6 +73,9 @@ class DecryptAllTest extends TestCase {
|
|||
$this->decryptAll = $this->getMockBuilder(\OC\Encryption\DecryptAll::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
$this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
|
||||
$this->consoleInput->expects($this->any())
|
||||
->method('isInteractive')
|
||||
->willReturn(true);
|
||||
$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
|
||||
|
||||
$this->config->expects($this->any())
|
||||
|
|
|
@ -78,6 +78,9 @@ class EncryptAllTest extends TestCase {
|
|||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$this->consoleInput = $this->getMockBuilder(InputInterface::class)->getMock();
|
||||
$this->consoleInput->expects($this->any())
|
||||
->method('isInteractive')
|
||||
->willReturn(true);
|
||||
$this->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue