Check if TTY is invalid in encryption:encrypt-all and encryption:decrypt-all
Signed-off-by: Evgeny Golyshev <eugulixes@gmail.com>
This commit is contained in:
parent
0fca815b4d
commit
ec2f02f4a0
|
@ -123,6 +123,14 @@ class DecryptAll extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
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 {
|
try {
|
||||||
if ($this->encryptionManager->isEnabled() === true) {
|
if ($this->encryptionManager->isEnabled() === true) {
|
||||||
|
|
|
@ -105,6 +105,14 @@ class EncryptAll extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
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) {
|
if ($this->encryptionManager->isEnabled() === false) {
|
||||||
throw new \Exception('Server side encryption is not enabled');
|
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)
|
$this->decryptAll = $this->getMockBuilder(\OC\Encryption\DecryptAll::class)
|
||||||
->disableOriginalConstructor()->getMock();
|
->disableOriginalConstructor()->getMock();
|
||||||
$this->consoleInput = $this->getMockBuilder(InputInterface::class)->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->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
|
||||||
|
|
||||||
$this->config->expects($this->any())
|
$this->config->expects($this->any())
|
||||||
|
|
|
@ -78,6 +78,9 @@ class EncryptAllTest extends TestCase {
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
$this->consoleInput = $this->getMockBuilder(InputInterface::class)->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->consoleOutput = $this->getMockBuilder(OutputInterface::class)->getMock();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue