summaryrefslogtreecommitdiffstats
path: root/core/Command/Integrity
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-06-26 14:54:51 +0200
committerJoas Schilling <coding@schilljs.com>2020-06-26 14:54:51 +0200
commitab21d69903c4360cbce59741624b6e765e3bd35f (patch)
tree8bed2d6af0d4bfef3766e356acc570b93eb9feb3 /core/Command/Integrity
parented4afa55c1ccaef140ac310258ad837bf6af9557 (diff)
downloadnextcloud-server-ab21d69903c4360cbce59741624b6e765e3bd35f.tar.gz
nextcloud-server-ab21d69903c4360cbce59741624b6e765e3bd35f.zip
Add return value to all commands
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'core/Command/Integrity')
-rw-r--r--core/Command/Integrity/CheckApp.php3
-rw-r--r--core/Command/Integrity/CheckCore.php3
-rw-r--r--core/Command/Integrity/SignApp.php8
-rw-r--r--core/Command/Integrity/SignCore.php8
4 files changed, 12 insertions, 10 deletions
diff --git a/core/Command/Integrity/CheckApp.php b/core/Command/Integrity/CheckApp.php
index e57e3fdc9db..225be750d24 100644
--- a/core/Command/Integrity/CheckApp.php
+++ b/core/Command/Integrity/CheckApp.php
@@ -66,7 +66,7 @@ class CheckApp extends Base {
/**
* {@inheritdoc }
*/
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$appid = $input->getArgument('appid');
$path = (string)$input->getOption('path');
$result = $this->checker->verifyAppSignature($appid, $path);
@@ -74,5 +74,6 @@ class CheckApp extends Base {
if (count($result)>0) {
return 1;
}
+ return 0;
}
}
diff --git a/core/Command/Integrity/CheckCore.php b/core/Command/Integrity/CheckCore.php
index ee61962d426..1dee7799900 100644
--- a/core/Command/Integrity/CheckCore.php
+++ b/core/Command/Integrity/CheckCore.php
@@ -59,11 +59,12 @@ class CheckCore extends Base {
/**
* {@inheritdoc }
*/
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$result = $this->checker->verifyCoreSignature();
$this->writeArrayInOutputFormat($input, $output, $result);
if (count($result)>0) {
return 1;
}
+ return 0;
}
}
diff --git a/core/Command/Integrity/SignApp.php b/core/Command/Integrity/SignApp.php
index c8a876dca5a..411ea43cbe0 100644
--- a/core/Command/Integrity/SignApp.php
+++ b/core/Command/Integrity/SignApp.php
@@ -73,7 +73,7 @@ class SignApp extends Command {
/**
* {@inheritdoc }
*/
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$path = $input->getOption('path');
$privateKeyPath = $input->getOption('privateKey');
$keyBundlePath = $input->getOption('certificate');
@@ -82,7 +82,7 @@ class SignApp extends Command {
$output->writeln('This command requires the --path, --privateKey and --certificate.');
$output->writeln('Example: ./occ integrity:sign-app --path="/Users/lukasreschke/Programming/myapp/" --privateKey="/Users/lukasreschke/private/myapp.key" --certificate="/Users/lukasreschke/public/mycert.crt"');
$output->writeln('For more information please consult the documentation: '. $documentationUrl);
- return null;
+ return 1;
}
$privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath);
@@ -90,12 +90,12 @@ class SignApp extends Command {
if ($privateKey === false) {
$output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath));
- return null;
+ return 1;
}
if ($keyBundle === false) {
$output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath));
- return null;
+ return 1;
}
$rsa = new RSA();
diff --git a/core/Command/Integrity/SignCore.php b/core/Command/Integrity/SignCore.php
index 6da09b52c10..54c1f2a5445 100644
--- a/core/Command/Integrity/SignCore.php
+++ b/core/Command/Integrity/SignCore.php
@@ -67,13 +67,13 @@ class SignCore extends Command {
/**
* {@inheritdoc }
*/
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$privateKeyPath = $input->getOption('privateKey');
$keyBundlePath = $input->getOption('certificate');
$path = $input->getOption('path');
if (is_null($privateKeyPath) || is_null($keyBundlePath) || is_null($path)) {
$output->writeln('--privateKey, --certificate and --path are required.');
- return null;
+ return 1;
}
$privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath);
@@ -81,12 +81,12 @@ class SignCore extends Command {
if ($privateKey === false) {
$output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath));
- return null;
+ return 1;
}
if ($keyBundle === false) {
$output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath));
- return null;
+ return 1;
}
$rsa = new RSA();