Browse Source
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
pull/11792/merge
Morris Jobke
8 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
22 additions and
0 deletions
-
core/Command/Encryption/DecryptAll.php
-
core/Command/Encryption/EncryptAll.php
-
tests/Core/Command/Encryption/DecryptAllTest.php
-
tests/Core/Command/Encryption/EncryptAllTest.php
|
|
|
@ -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(); |
|
|
|
|
|
|
|
} |
|
|
|
|