]> git.sur5r.net Git - bacula/bacula/commitdiff
baculum: Remove fileset parameter from run restore
authorMarcin Haba <marcin.haba@bacula.pl>
Sun, 30 Jul 2017 12:41:09 +0000 (14:41 +0200)
committerMarcin Haba <marcin.haba@bacula.pl>
Sun, 30 Jul 2017 13:01:20 +0000 (15:01 +0200)
gui/baculum/protected/API/Pages/API/RestoreRun.php

index 09e517fd8dae26c6175c99356cd740d1a7de9996..c3b107d6ad05d8a8670114877e13f167f784d1b1 100644 (file)
@@ -26,11 +26,6 @@ class RestoreRun extends BaculumAPIServer {
 
        public function create($params) {
                $rfile = property_exists($params, 'rpath') ? $params->rpath : null;
-
-               $fileset = null;
-               if (property_exists($params, 'fileset') && $this->getModule('misc')->isValidName($params->fileset)) {
-                       $fileset = $params->fileset;
-               }
                $client = null;
                if (property_exists($params, 'clientid')) {
                        $clientid = intval($params->clientid);
@@ -48,46 +43,40 @@ class RestoreRun extends BaculumAPIServer {
                }
                $misc = $this->getModule('misc');
 
-               if(!is_null($fileset)) {
-                       if(!is_null($client)) {
-                               if(preg_match($misc::RPATH_PATTERN, $rfile) === 1) {
-                                       if(!is_null($where)) {
-                                               if(!is_null($replace)) {
-                                                       $command = array('restore',
-                                                               'file="?' . $rfile . '"',
-                                                               'client="' . $client . '"',
-                                                               'where="' . $where . '"',
-                                                               'replace="' . $replace . '"',
-                                                               'fileset="' . $fileset . '"',
-                                                               'priority="' . $priority . '"'
-                                                       );
-                                                       if (!is_null($restorejob)) {
-                                                               $command[] = 'restorejob="' . $restorejob . '"';
-                                                       }
-                                                       $command[] = 'yes';
-                                                       $restore = $this->getModule('bconsole')->bconsoleCommand($this->director, $command, $this->user);
-                                                       $this->removeTmpRestoreTable($rfile);
-                                                       $this->output = $restore->output;
-                                                       $this->error = (integer)$restore->exitcode;
-                                               } else {
-                                                       $this->output = JobError::MSG_ERROR_INVALID_REPLACE_OPTION;
-                                                       $this->error = JobError::ERROR_INVALID_REPLACE_OPTION;
+               if(!is_null($client)) {
+                       if(preg_match($misc::RPATH_PATTERN, $rfile) === 1) {
+                               if(!is_null($where)) {
+                                       if(!is_null($replace)) {
+                                               $command = array('restore',
+                                                       'file="?' . $rfile . '"',
+                                                       'client="' . $client . '"',
+                                                       'where="' . $where . '"',
+                                                       'replace="' . $replace . '"',
+                                                       'priority="' . $priority . '"'
+                                               );
+                                               if (!is_null($restorejob)) {
+                                                       $command[] = 'restorejob="' . $restorejob . '"';
                                                }
+                                               $command[] = 'yes';
+                                               $restore = $this->getModule('bconsole')->bconsoleCommand($this->director, $command, $this->user);
+                                               $this->removeTmpRestoreTable($rfile);
+                                               $this->output = $restore->output;
+                                               $this->error = (integer)$restore->exitcode;
                                        } else {
-                                               $this->output = JobError::MSG_ERROR_INVALID_WHERE_OPTION;
-                                               $this->error = JobError::ERROR_INVALID_WHERE_OPTION;
+                                               $this->output = JobError::MSG_ERROR_INVALID_REPLACE_OPTION;
+                                               $this->error = JobError::ERROR_INVALID_REPLACE_OPTION;
                                        }
                                } else {
-                                       $this->output = JobError::MSG_ERROR_INVALID_RPATH;
-                                       $this->error = JobError::ERROR_INVALID_RPATH;
+                                       $this->output = JobError::MSG_ERROR_INVALID_WHERE_OPTION;
+                                       $this->error = JobError::ERROR_INVALID_WHERE_OPTION;
                                }
                        } else {
-                               $this->output = JobError::MSG_ERROR_CLIENT_DOES_NOT_EXISTS;
-                               $this->error = JobError::ERROR_CLIENT_DOES_NOT_EXISTS;
+                               $this->output = JobError::MSG_ERROR_INVALID_RPATH;
+                               $this->error = JobError::ERROR_INVALID_RPATH;
                        }
                } else {
-                       $this->output = JobError::MSG_ERROR_FILESET_DOES_NOT_EXISTS;
-                       $this->error = JobError::ERROR_FILESET_DOES_NOT_EXISTS;
+                       $this->output = JobError::MSG_ERROR_CLIENT_DOES_NOT_EXISTS;
+                       $this->error = JobError::ERROR_CLIENT_DOES_NOT_EXISTS;
                }
        }