]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Enable using show command output also for internal purposes
authorMarcin Haba <marcin.haba@bacula.pl>
Mon, 17 Apr 2023 07:51:03 +0000 (09:51 +0200)
committerMarcin Haba <marcin.haba@bacula.pl>
Thu, 20 Apr 2023 10:00:26 +0000 (12:00 +0200)
gui/baculum/protected/API/Pages/API/JobsShow.php

index 6da2755632d4909bd175618d948a0cdff8e7ff35..e30096efe8903439dccb0b44ec51315f6f8d97a1 100644 (file)
@@ -20,6 +20,8 @@
  * Bacula(R) is a registered trademark of Kern Sibbald.
  */
 
+namespace Baculum\API\Pages\API;
+
 use Baculum\API\Modules\ConsoleOutputPage;
 use Baculum\API\Modules\ConsoleOutputShowPage;
 use Baculum\Common\Modules\Errors\JobError;
@@ -35,6 +37,12 @@ class JobsShow extends ConsoleOutputShowPage {
 
        public function get() {
                $out_format = $this->Request->contains('output') && $this->isOutputFormatValid($this->Request['output']) ? $this->Request['output'] : ConsoleOutputPage::OUTPUT_FORMAT_RAW;
+               $out = $this->show($out_format);
+               $this->output = $out->output;
+               $this->error = $out->exitcode;
+       }
+
+       public function show($out_format) {
                $result = $this->getModule('bconsole')->bconsoleCommand(
                        $this->director,
                        ['.jobs'],
@@ -71,8 +79,7 @@ class JobsShow extends ConsoleOutputShowPage {
                } elseif($out_format === ConsoleOutputPage::OUTPUT_FORMAT_JSON) {
                        $out = $this->getJSONOutput($params);
                }
-               $this->output = $out->output;
-               $this->error = $out->exitcode;
+               return $out;
        }
 
        /**