From 21e4d1550770c2786c70ddad696b622c43087381 Mon Sep 17 00:00:00 2001 From: Marcin Haba Date: Sun, 30 Jul 2017 14:41:09 +0200 Subject: [PATCH] baculum: Remove fileset parameter from run restore --- .../protected/API/Pages/API/RestoreRun.php | 63 ++++++++----------- 1 file changed, 26 insertions(+), 37 deletions(-) diff --git a/gui/baculum/protected/API/Pages/API/RestoreRun.php b/gui/baculum/protected/API/Pages/API/RestoreRun.php index 09e517fd8d..c3b107d6ad 100644 --- a/gui/baculum/protected/API/Pages/API/RestoreRun.php +++ b/gui/baculum/protected/API/Pages/API/RestoreRun.php @@ -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; } } -- 2.39.5