]> source.dussan.org Git - nextcloud-server.git/commitdiff
Print output also with status code
authorJoas Schilling <coding@schilljs.com>
Tue, 3 Jan 2023 11:47:58 +0000 (12:47 +0100)
committerJoas Schilling <coding@schilljs.com>
Tue, 3 Jan 2023 11:47:58 +0000 (12:47 +0100)
Signed-off-by: Joas Schilling <coding@schilljs.com>
core/Command/Status.php

index 9b3af59b94a344f31fc740c6ccb11ae87c51c5b6..7e6e3502adacbbf2a19fea915096faecf27717bf 100644 (file)
@@ -59,15 +59,6 @@ class Status extends Base {
        protected function execute(InputInterface $input, OutputInterface $output): int {
                $maintenanceMode = $this->config->getSystemValueBool('maintenance', false);
                $needUpgrade = Util::needUpgrade();
-               if ($input->getOption('exit-code')) {
-                       if ($maintenanceMode === true) {
-                               return 1;
-                       } elseif ($needUpgrade == true) {
-                               return 2;
-                       } else {
-                               return 0;
-                       }
-               }
                $values = [
                        'installed' => $this->config->getSystemValueBool('installed', false),
                        'version' => implode('.', Util::getVersion()),
@@ -80,6 +71,14 @@ class Status extends Base {
                ];
 
                $this->writeArrayInOutputFormat($input, $output, $values);
+               if ($input->getOption('exit-code')) {
+                       if ($maintenanceMode === true) {
+                               return 1;
+                       }
+                       if ($needUpgrade === true) {
+                               return 2;
+                       }
+               }
                return 0;
        }
 }