]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Move running job estimation to background in API part
authorMarcin Haba <marcin.haba@bacula.pl>
Tue, 14 May 2019 17:16:22 +0000 (19:16 +0200)
committerMarcin Haba <marcin.haba@bacula.pl>
Sat, 14 Dec 2019 14:50:01 +0000 (15:50 +0100)
gui/baculum/protected/API/Pages/API/JobEstimate.php

index 6bf44190950b28a2d9de2dc4b98351078eb12fe5..39d9c555bd17abe0d1d8fb337dcf188deb42ff39 100644 (file)
  * Bacula(R) is a registered trademark of Kern Sibbald.
  */
  
+Prado::using('Application.API.Class.Bconsole');
+
 class JobEstimate extends BaculumAPIServer {
 
+       public function get() {
+               $output = array();
+               $misc = $this->getModule('misc');
+               if ($this->Request->contains('out_id') && $misc->isValidAlphaNumeric($this->Request->itemAt('out_id'))) {
+                       $out_id = $this->Request->itemAt('out_id');
+                       $output = Bconsole::readOutputFile($out_id);
+               }
+               $this->output = $output;
+               $this->error = VolumeError::ERROR_NO_ERRORS;
+       }
+
        public function create($params) {
                $job = null;
                if (property_exists($params, 'id')) {
@@ -101,7 +114,12 @@ class JobEstimate extends BaculumAPIServer {
                        'client="' . $client . '"',
                        'accurate="' . $accurate . '"'
                );
-               $result = $this->getModule('bconsole')->bconsoleCommand($this->director, $cmd);
+               $result = $this->getModule('bconsole')->bconsoleCommand(
+                       $this->director,
+                       $cmd,
+                       Bconsole::PTYPE_BG_CMD
+               );
+               array_shift($result->output);
                $this->output = $result->output;
                $this->error = $result->exitcode;
        }