class BVFSClearCache extends BaculumAPIServer {
- public function set($ids, $params) {
- $result = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.bvfs_clear_cache', 'yes'), $this->user);
+ public function set($id, $params) {
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.bvfs_clear_cache', 'yes'));
$this->output = $result->output;
$this->error = $result->exitcode;
}
class BVFSGetJobids extends BaculumAPIServer {
public function get() {
- $jobid = intval($this->Request['id']);
- $job = $this->getModule('job')->getJobById($jobid);
- if(!is_null($job)) {
- $cmd = array('.bvfs_get_jobids', 'jobid="' . $job->jobid . '"');
- $result = $this->getModule('bconsole')->bconsoleCommand($this->director, $cmd, $this->user);
+ $jobid = $this->Request->contains('id') ? intval($this->Request['id']) : 0;
+ if ($jobid > 0) {
+ $cmd = array('.bvfs_get_jobids', 'jobid="' . $jobid . '"');
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, $cmd);
$this->output = $result->output;
$this->error = $result->exitcode;
} else {
- $this->output = BVFSError::MSG_ERROR_JOB_DOES_NOT_EXISTS;
- $this->error = BVFSError::ERROR_JOB_DOES_NOT_EXISTS;
+ $this->output = BVFSError::MSG_ERROR_INVALID_JOBID;
+ $this->error = BVFSError::ERROR_INVALID_JOBID;
}
}
}
class BVFSLsDirs extends BaculumAPIServer {
- public function set($param, $ids) {
- $limit = intval($this->Request['limit']);
- $offset = intval($this->Request['offset']);
- $is_valid = true;
- if (property_exists($ids, 'jobids')) {
- $jobids = explode(',', $ids->jobids);
- for($i = 0; $i < count($jobids); $i++) {
- $job = $this->getModule('job')->getJobById($jobids[$i]);
- if(is_null($job)) {
- $is_valid = false;
- break;
- }
- }
- } else {
- $is_valid = false;
+ public function set($id, $params) {
+ $limit = $this->Request->contains('limit') ? intval($this->Request['limit']) : 0;
+ $offset = $this->Request->contains('offset') ? intval($this->Request['offset']) : 0;
+ $jobids = null;
+ if (property_exists($params, 'jobids') && $this->getModule('misc')->isValidIdsList($params->jobids)) {
+ $jobids = $params->jobids;
}
$path = null;
- if (property_exists($ids, 'path')) {
- $path = $ids->path;
+ if (property_exists($params, 'path') && $this->getModule('misc')->isValidPath($params->path)) {
+ $path = $params->path;
}
- if($is_valid === true) {
- if (!is_null($path)) {
- $cmd = array('.bvfs_lsdirs', 'jobid="' . $ids->jobids . '"', 'path="' . $path . '"');
+ if (is_null($jobids)) {
+ $this->output = BVFSError::MSG_ERROR_INVALID_JOBID_LIST;
+ $this->error = BVFSError::ERROR_INVALID_JOBID_LIST;
+ return;
+ }
+
+ if (is_null($path)) {
+ $this->output = BVFSError::ERROR_INVALID_RESTORE_PATH;
+ $this->error = BVFSError::MSG_ERROR_INVALID_RESTORE_PATH;
+ return;
+ }
- if($offset > 0) {
- array_push($cmd, 'offset="' . $offset . '"');
- }
- if($limit > 0) {
- array_push($cmd, 'limit="' . $limit . '"');
- }
- $result = $this->getModule('bconsole')->bconsoleCommand($this->director, $cmd, $this->user);
- $this->output = $result->output;
- $this->error = $result->exitcode;
- } else {
- $this->output = BVFSError::ERROR_INVALID_RESTORE_PATH;
- $this->error = BVFSError::MSG_ERROR_INVALID_RESTORE_PATH;
- }
- } else {
- $this->output = BVFSError::MSG_ERROR_JOB_DOES_NOT_EXISTS;
- $this->error = BVFSError::ERROR_JOB_DOES_NOT_EXISTS;
+ $cmd = array('.bvfs_lsdirs', 'jobid="' . $jobids . '"', 'path="' . $path . '"');
+
+ if ($offset > 0) {
+ array_push($cmd, 'offset="' . $offset . '"');
+ }
+ if ($limit > 0) {
+ array_push($cmd, 'limit="' . $limit . '"');
}
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, $cmd);
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
}
}
?>
class BVFSLsFiles extends BaculumAPIServer {
- public function set($param, $ids) {
- $limit = intval($this->Request['limit']);
- $offset = intval($this->Request['offset']);
- $is_valid = true;
- if (property_exists($ids, 'jobids')) {
- $jobids = explode(',', $ids->jobids);
- for($i = 0; $i < count($jobids); $i++) {
- $job = $this->getModule('job')->getJobById($jobids[$i]);
- if(is_null($job)) {
- $is_valid = false;
- break;
- }
- }
- } else {
- $is_valid = false;
+ public function set($id, $params) {
+ $limit = $this->Request->contains('limit') ? intval($this->Request['limit']) : 0;
+ $offset = $this->Request->contains('offset') ? intval($this->Request['offset']) : 0;
+ $jobids = null;
+ if (property_exists($params, 'jobids') && $this->getModule('misc')->isValidIdsList($params->jobids)) {
+ $jobids = $params->jobids;
}
$path = null;
- if (property_exists($ids, 'path')) {
- $path = $ids->path;
+ if (property_exists($params, 'path') && $this->getModule('misc')->isValidPath($params->path)) {
+ $path = $params->path;
}
- if($is_valid === true) {
- if (!is_null($path)) {
- $cmd = array('.bvfs_lsfiles', 'jobid="' . $ids->jobids . '"', 'path="' . $path . '"');
- if($offset > 0) {
- array_push($cmd, 'offset="' . $offset . '"');
- }
- if($limit > 0) {
- array_push($cmd, 'limit="' . $limit . '"');
- }
- $result = $this->getModule('bconsole')->bconsoleCommand($this->director, $cmd, $this->user);
- $this->output = $result->output;
- $this->error = $result->exitcode;
- } else {
- $this->output = BVFSError::ERROR_INVALID_RESTORE_PATH;
- $this->error = BVFSError::MSG_ERROR_INVALID_RESTORE_PATH;
- }
- } else {
- $this->output = BVFSError::MSG_ERROR_JOB_DOES_NOT_EXISTS;
- $this->error = BVFSError::ERROR_JOB_DOES_NOT_EXISTS;
+ if (is_null($jobids)) {
+ $this->output = BVFSError::MSG_ERROR_INVALID_JOBID_LIST;
+ $this->error = BVFSError::ERROR_INVALID_JOBID_LIST;
+ return;
}
+
+ if (is_null($path)) {
+ $this->output = BVFSError::ERROR_INVALID_RESTORE_PATH;
+ $this->error = BVFSError::MSG_ERROR_INVALID_RESTORE_PATH;
+ return;
+ }
+
+ $cmd = array('.bvfs_lsfiles', 'jobid="' . $jobids . '"', 'path="' . $path . '"');
+
+ if ($offset > 0) {
+ array_push($cmd, 'offset="' . $offset . '"');
+ }
+ if ($limit > 0) {
+ array_push($cmd, 'limit="' . $limit . '"');
+ }
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, $cmd);
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
}
}
?>
array_push($cmd, 'hardlink="' . $findexes . '"');
}
- $result = $this->getModule('bconsole')->bconsoleCommand($this->director, $cmd, $this->user);
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, $cmd);
$this->output = $result->output;
$this->error = $result->exitcode;
}
class BVFSUpdate extends BaculumAPIServer {
- public function set($param, $ids) {
- $isValid = true;
- if (property_exists($ids, 'jobids')) {
- $jobids = explode(',', $ids->jobids);
- for($i = 0; $i < count($jobids); $i++) {
- $job = $this->getModule('job')->getJobById($jobids[$i]);
- if(is_null($job)) {
- $isValid = false;
- break;
- }
- }
- } else {
- $isValid = false;
+ public function set($id, $params) {
+ $jobids = null;
+ if (property_exists($params, 'jobids') && $this->getModule('misc')->isValidIdsList($params->jobids)) {
+ $jobids = $params->jobids;
}
- if($isValid === true) {
- $result = $this->getModule('bconsole')->bconsoleCommand(
- $this->director,
- array('.bvfs_update', 'jobid="' . $ids->jobids . '"'),
- $this->user
- );
- $this->output = $result->output;
- $this->error = $result->exitcode;
- } else {
- $this->output = BVFSError::MSG_ERROR_JOB_DOES_NOT_EXISTS;
- $this->error = BVFSError::ERROR_JOB_DOES_NOT_EXISTS;
+ if (is_null($jobids)) {
+ $this->output = BVFSError::MSG_ERROR_INVALID_JOBID_LIST;
+ $this->error = BVFSError::ERROR_INVALID_JOBID_LIST;
+ return;
}
+
+ $result = $this->getModule('bconsole')->bconsoleCommand(
+ $this->director,
+ array('.bvfs_update', 'jobid="' . $jobids . '"')
+ );
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
}
}
?>
class BVFSVersions extends BaculumAPIServer {
public function get() {
- $jobid = intval($this->Request['jobid']);
- $pathid = $this->Request['pathid'];
- $filenameid = intval($this->Request['filenameid']);
- $client = $this->Request['client'];
- $job = $this->getModule('job')->getJobById($jobid);
- if(!is_null($job)) {
- $cmd = array(
- '.bvfs_versions',
- 'client="' . $client . '"',
- 'jobid="' . $job->jobid . '"',
- 'pathid="' . $pathid . '"',
- 'fnid="' . $filenameid . '"'
- );
- $result = $this->getModule('bconsole')->bconsoleCommand($this->director, $cmd, $this->user);
- $this->output = $result->output;
- $this->error = $result->exitcode;
- } else {
- $this->output = BVFSError::MSG_ERROR_JOB_DOES_NOT_EXISTS;
- $this->error = BVFSError::ERROR_JOB_DOES_NOT_EXISTS;
+ $jobid = $this->Request->contains('jobid') ? intval($this->Request['jobid']) : 0;
+ $pathid = $this->Request->contains('pathid') ? intval($this->Request['pathid']) : 0;
+ $filenameid = $this->Request->contains('filenameid') ? intval($this->Request['filenameid']) : 0;
+ $client = null;
+ if ($this->Request->contains('client') && $this->getModule('misc')->isValidName($this->Request['client'])) {
+ $client = $this->Request['client'];
}
+
+ if (is_null($client)) {
+ $this->output = BVFSError::MSG_ERROR_INVALID_CLIENT;
+ $this->error = BVFSError::ERROR_INVALID_CLIENT;
+ return;
+ }
+
+ $cmd = array(
+ '.bvfs_versions',
+ 'client="' . $client . '"',
+ 'jobid="' . $jobid . '"',
+ 'pathid="' . $pathid . '"',
+ 'fnid="' . $filenameid . '"'
+ );
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, $cmd);
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
}
}
?>
*/
class Catalog extends BaculumAPIServer {
+
public function get() {
$result = $this->getModule('db')->testCatalog();
- if ($result === true) {
+ if ($result) {
$this->output = DatabaseError::MSG_ERROR_NO_ERRORS;
$this->error = DatabaseError::ERROR_NO_ERRORS;
} else {
class Client extends BaculumAPIServer {
public function get() {
- $clientid = intval($this->Request['id']);
+ $clientid = $this->Request->contains('id') ? intval($this->Request['id']) : 0;
$client = $this->getModule('client')->getClientById($clientid);
- $allowed_clients = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.client'), $this->user);
- if ($allowed_clients->exitcode === 0) {
- if(!is_null($client) && in_array($client->name, $allowed_clients->output)) {
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.client'));
+ if ($result->exitcode === 0) {
+ if(!is_null($client) && in_array($client->name, $result->output)) {
$this->output = $client;
$this->error = ClientError::ERROR_NO_ERRORS;
} else {
$this->error =ClientError::ERROR_CLIENT_DOES_NOT_EXISTS;
}
} else {
- $this->output = $allowed_clients->output;
- $this->error = $allowed_clients->exitcode;
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
}
}
}
class ClientShow extends BaculumAPIServer {
public function get() {
- $clientid = intval($this->Request['id']);
+ $clientid = $this->Request->contains('id') ? intval($this->Request['id']) : 0;
$client = $this->getModule('client')->getClientById($clientid);
- if(!is_null($client)) {
- $client_show = $this->getModule('bconsole')->bconsoleCommand($this->director, array('show', 'client="' . $client->name . '"'), $this->user);
- $this->output = $client_show->output;
- $this->error = $client_show->exitcode;
+ if(is_object($client)) {
+ $result = $this->getModule('bconsole')->bconsoleCommand(
+ $this->director,
+ array('show', 'client="' . $client->name . '"')
+ );
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
} else {
$this->output = ClientError::MSG_ERROR_CLIENT_DOES_NOT_EXISTS;
$this->error = ClientError::ERROR_CLIENT_DOES_NOT_EXISTS;
class ClientStatus extends BaculumAPIServer {
public function get() {
- $clientid = intval($this->Request['id']);
+ $clientid = $this->Request->contains('id') ? intval($this->Request['id']) : 0;
$client = $this->getModule('client')->getClientById($clientid);
- if(!is_null($client)) {
- $client_status = $this->getModule('bconsole')->bconsoleCommand($this->director, array('status', 'client="' . $client->name . '"'), $this->user);
- $this->output = $client_status->output;
- $this->error = (integer)$client_status->exitcode;
+ if(is_object($client)) {
+ $result = $this->getModule('bconsole')->bconsoleCommand(
+ $this->director,
+ array('status', 'client="' . $client->name . '"')
+ );
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
} else {
$this->output = ClientError::MSG_ERROR_CLIENT_DOES_NOT_EXISTS;
$this->error = ClientError::ERROR_CLIENT_DOES_NOT_EXISTS;
* Bacula(R) is a registered trademark of Kern Sibbald.
*/
-/**
- * Clients resources.
- *
- * Data format:
- * {
- * "output": [
- * {
- * "clientid": client ID,
- * "name": "client name",
- * "uname": "client name and environment (uname -a)",
- * "autoprune": 0 for disabled, 1 for enabled,
- * "fileretention": file retention period in seconds,
- * "jobretention": job retention period in seconds,
- * },
- * {
- * "clientid": client ID,
- * "name": "client name",
- * "uname": "client name and environment (uname -a)",
- * "autoprune": 0 for disabled, 1 for enabled,
- * "fileretention": file retention period in seconds,
- * "jobretention": job retention period in seconds,
- * }
- * etc...
- * ],
- * "error": 0 for no errors, 1 for error
- * }
- */
-
class Clients extends BaculumAPIServer {
public function get() {
- $limit = intval($this->Request['limit']);
+ $limit = $this->Request->contains('limit') ? intval($this->Request['limit']) : 0;
$clients = $this->getModule('client')->getClients($limit);
- $allowed_clients = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.client'), $this->user);
- if ($allowed_clients->exitcode === 0) {
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.client'));
+ if ($result->exitcode === 0) {
$clients_output = array();
foreach($clients as $client) {
- if(in_array($client->name, $allowed_clients->output)) {
+ if(in_array($client->name, $result->output)) {
$clients_output[] = $client;
}
}
$this->error = ClientError::ERROR_NO_ERRORS;
} else {
- $this->output = $allowed_clients->output;
- $this->error = $allowed_clients->exitcode;
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
}
}
}
class ClientsShow extends BaculumAPIServer {
public function get() {
- $clients = $this->getModule('bconsole')->bconsoleCommand(
+ $result = $this->getModule('bconsole')->bconsoleCommand(
$this->director,
- array('show', 'clients'),
- $this->user
+ array('show', 'clients')
);
- $this->output = $clients->output;
- $this->error = $clients->exitcode;
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
}
}
?>
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
public function set($id, $params) {
$params = (array)$params;
- $console = $this->getModule('bconsole')->bconsoleCommand($this->director, $params, $this->user);
- $this->output = $console->output;
- $this->error = (integer)$console->exitcode;
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, $params);
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
}
}
-?>
\ No newline at end of file
+?>
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class Directors extends BaculumAPIServer {
public function get() {
- $directors = $this->getModule('bconsole')->getDirectors();
- if($directors->exitcode === 0) {
- $this->output = $directors->output;
+ $result = $this->getModule('bconsole')->getDirectors();
+ if($result->exitcode === 0) {
+ $this->output = $result->output;
$this->error = BconsoleError::ERROR_NO_ERRORS;
} else {
- $this->output = $directors->output;
- $this->error = $directors->exitcode;
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
}
}
}
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class FileSet extends BaculumAPIServer {
public function get() {
- $filesetid = intval($this->Request['id']);
+ $filesetid = $this->Request->contains('id') ? intval($this->Request['id']) : 0;
$fileset = $this->getModule('fileset')->getFileSetById($filesetid);
- $allowedFileSets = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.fileset'), $this->user);
- if ($allowedFileSets->exitcode === 0) {
- if(!is_null($fileset) && in_array($fileset->fileset, $allowedFileSets->output)) {
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.fileset'));
+ if ($result->exitcode === 0) {
+ if(!is_null($fileset) && in_array($fileset->fileset, $result->output)) {
$this->output = $fileset;
$this->error = FileSetError::ERROR_NO_ERRORS;
} else {
$this->error = FileSetError::ERROR_FILESET_DOES_NOT_EXISTS;
}
} else {
- $this->output = $allowedFileSets->output;
- $this->error = $allowedFileSets->exitcode;
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
}
}
}
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class FileSets extends BaculumAPIServer {
public function get() {
$directors = $this->getModule('bconsole')->getDirectors();
- if($directors->exitcode === 0) {
- $filesets = array();
- $error = false;
- $error_obj = null;
- for($i = 0; $i < count($directors->output); $i++) {
- $filesetsshow = $this->getModule('bconsole')->bconsoleCommand($directors->output[$i], array('show', 'fileset'), $this->user);
- if ($filesetsshow->exitcode != 0) {
- $error_obj = $filesetsshow;
- $error = true;
- break;
- }
- $filesets[$directors->output[$i]] = array();
-
- for($j = 0; $j < count($filesetsshow->output); $j++) {
- if(preg_match('/^FileSet:\ name=(.+?(?=\s\S+\=.+)|.+$)/i', $filesetsshow->output[$j], $match) === 1) {
- $filesets[$directors->output[$i]][] = $match[1];
- }
- }
+ if($directors->exitcode != 0) {
+ $this->output = $directors->output;
+ $this->error = $directors->exitcode;
+ return;
+ }
+
+ $filesets = array();
+ $error = false;
+ $error_obj = null;
+ for($i = 0; $i < count($directors->output); $i++) {
+ $result = $this->getModule('bconsole')->bconsoleCommand($directors->output[$i], array('show', 'fileset'));
+ if ($result->exitcode != 0) {
+ $error_obj = $result;
+ $error = true;
+ break;
}
+ $filesets[$directors->output[$i]] = array();
- if ($error === true) {
- $this->output = $error_obj->output;
- $this->error = $error_obj->exitcode;
- } else {
- $this->output = $filesets;
- $this->error = BconsoleError::ERROR_NO_ERRORS;
+ for($j = 0; $j < count($result->output); $j++) {
+ if(preg_match('/^FileSet:\ name=(.+?(?=\s\S+\=.+)|.+$)/i', $result->output[$j], $match) === 1) {
+ $filesets[$directors->output[$i]][] = $match[1];
+ }
}
+ }
+
+ if ($error === true) {
+ $this->output = $error_obj->output;
+ $this->error = $error_obj->exitcode;
} else {
- $this->output = $directors->output;
- $this->error = $directors->exitcode;
+ $this->output = $filesets;
+ $this->error = BconsoleError::ERROR_NO_ERRORS;
}
}
}
public function get() {
$filesets = $this->getModule('fileset')->getFileSets();
- $allowed_filesets = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.fileset'), $this->user);
- if ($allowed_filesets->exitcode === 0) {
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.fileset'));
+ if ($result->exitcode === 0) {
if (is_array($filesets) && count($filesets) > 0) {
$fs = array();
for ($i = 0; $i < count($filesets); $i++) {
- if(in_array($filesets[$i]->fileset, $allowed_filesets->output)) {
+ if(in_array($filesets[$i]->fileset, $result->output)) {
$fs[] = $filesets[$i];
}
}
$this->error = FileSetError::ERROR_FILESET_DOES_NOT_EXISTS;
}
} else {
- $this->output = $allowed_filesets->output;
- $this->error = $allowed_filesets->exitcode;
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
}
}
}
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class Job extends BaculumAPIServer {
public function get() {
- $jobid = intval($this->Request['id']);
+ $jobid = $this->Request->contains('id') ? intval($this->Request['id']) : 0;
$job = $this->getModule('job')->getJobById($jobid);
- $allowedJobs = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.jobs'), $this->user);
- if ($allowedJobs->exitcode === 0) {
- if(!is_null($job) && in_array($job->name, $allowedJobs->output)) {
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.jobs'));
+ if ($result->exitcode === 0) {
+ if(!is_null($job) && in_array($job->name, $result->output)) {
$this->output = $job;
$this->error = JobError::ERROR_NO_ERRORS;
} else {
$this->error = JobError::ERROR_JOB_DOES_NOT_EXISTS;
}
} else {
- $this->output = $allowedJobs->output;
- $this->error = $allowedJobs->exitcode;
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
}
}
$jobid = intval($id);
$job = $this->getModule('job')->getJobById($jobid);
if(!is_null($job)) {
- $delete = $this->getModule('bconsole')->bconsoleCommand($this->director, array('delete', 'jobid="' . $job->jobid . '"'), $this->user);
+ $delete = $this->getModule('bconsole')->bconsoleCommand(
+ $this->director,
+ array('delete', 'jobid="' . $job->jobid . '"')
+ );
$this->output = $delete->output;
$this->error = (integer)$delete->exitcode;
} else {
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
$jobid = intval($id);
$job = $this->getModule('job')->getJobById($jobid);
- if(!is_null($job)) {
- $cancel = $this->getModule('bconsole')->bconsoleCommand($this->director, array('cancel', 'jobid="' . $job->jobid . '"'), $this->user);
+ if(is_object($job)) {
+ $cancel = $this->getModule('bconsole')->bconsoleCommand(
+ $this->director,
+ array('cancel', 'jobid="' . $job->jobid . '"')
+ );
$this->output = $cancel->output;
- $this->error = (integer)$cancel->exitcode;
+ $this->error = $cancel->exitcode;
} else {
$this->output = JobError::MSG_ERROR_JOB_DOES_NOT_EXISTS;
$this->error = JobError::ERROR_JOB_DOES_NOT_EXISTS;
}
}
-?>
\ No newline at end of file
+?>
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
$accurate = $accurate_job === 1 ? 'yes' : 'no';
}
- if (!is_null($job)) {
- $is_valid_level = $this->getModule('misc')->isValidJobLevel($params->level);
- if ($is_valid_level === true) {
- if (!is_null($fileset)) {
- if (!is_null($client)) {
- $joblevels = $this->getModule('misc')->getJobLevels();
- $cmd = array(
- 'estimate',
- 'job="' . $job . '"',
- 'level="' . $joblevels[$level] . '"',
- 'fileset="' . $fileset. '"',
- 'client="' . $client . '"',
- 'accurate="' . $accurate . '"'
- );
- $estimation = $this->getModule('bconsole')->bconsoleCommand($this->director, $cmd, $this->user);
- $this->output = $estimation->output;
- $this->error = (integer)$estimation->exitcode;
- } else {
- $this->output = JobError::MSG_ERROR_CLIENT_DOES_NOT_EXISTS;
- $this->error = JobError::ERROR_CLIENT_DOES_NOT_EXISTS;
- }
- } else {
- $this->output = JobError::MSG_ERROR_FILESET_DOES_NOT_EXISTS;
- $this->error = JobError::ERROR_FILESET_DOES_NOT_EXISTS;
- }
- } else {
- $this->output = JobError::MSG_ERROR_INVALID_JOBLEVEL;
- $this->error = JobError::ERROR_INVALID_JOBLEVEL;
- }
- } else {
+ if (is_null($job)) {
$this->output = JobError::MSG_ERROR_JOB_DOES_NOT_EXISTS;
$this->error = JobError::ERROR_JOB_DOES_NOT_EXISTS;
+ return;
}
+
+ $is_valid_level = $this->getModule('misc')->isValidJobLevel($params->level);
+ if (!$is_valid_level) {
+ $this->output = JobError::MSG_ERROR_INVALID_JOBLEVEL;
+ $this->error = JobError::ERROR_INVALID_JOBLEVEL;
+ return;
+ }
+
+ if (is_null($fileset)) {
+ $this->output = JobError::MSG_ERROR_FILESET_DOES_NOT_EXISTS;
+ $this->error = JobError::ERROR_FILESET_DOES_NOT_EXISTS;
+ return;
+ }
+
+ if (is_null($client)) {
+ $this->output = JobError::MSG_ERROR_CLIENT_DOES_NOT_EXISTS;
+ $this->error = JobError::ERROR_CLIENT_DOES_NOT_EXISTS;
+ return;
+ }
+
+ $joblevels = $this->getModule('misc')->getJobLevels();
+ $cmd = array(
+ 'estimate',
+ 'job="' . $job . '"',
+ 'level="' . $joblevels[$level] . '"',
+ 'fileset="' . $fileset. '"',
+ 'client="' . $client . '"',
+ 'accurate="' . $accurate . '"'
+ );
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, $cmd);
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
}
}
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class JobLog extends BaculumAPIServer {
public function get() {
- $jobid = intval($this->Request['id']);
+ $jobid = $this->Request->contains('id') ? intval($this->Request['id']) : 0;
$job = $this->getModule('job')->getJobById($jobid);
- if(!is_null($job)) {
+ if(is_object($job)) {
$log = $this->getModule('joblog')->getLogByJobId($job->jobid);
$log = array_map('trim', $log);
// Output may contain national characters.
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
$verifyjob = 'verifyjob="' . $params->verifyjob . '"';
}
- if(!is_null($job)) {
- $is_valid_level = $this->getModule('misc')->isValidJobLevel($params->level);
- if($is_valid_level === true) {
- if(!is_null($fileset)) {
- if(!is_null($client)) {
- if(!is_null($storage)) {
- if(!is_null($pool)) {
- $joblevels = $this->getModule('misc')->getJobLevels();
- $command = array(
- 'run',
- 'job="' . $job . '"',
- 'level="' . $joblevels[$level] . '"',
- 'fileset="' . $fileset . '"',
- 'client="' . $client . '"',
- 'storage="' . $storage . '"',
- 'pool="' . $pool . '"' ,
- 'priority="' . $priority . '"',
- $jobid,
- $verifyjob,
- 'yes'
- );
- $run = $this->getModule('bconsole')->bconsoleCommand($this->director, $command, $this->user);
- $this->output = $run->output;
- $this->error = (integer)$run->exitcode;
- } else {
- $this->output = JobError::MSG_ERROR_POOL_DOES_NOT_EXISTS;
- $this->error = JobError::ERROR_POOL_DOES_NOT_EXISTS;
- }
- } else {
- $this->output = JobError::MSG_ERROR_STORAGE_DOES_NOT_EXISTS;
- $this->error = JobError::ERROR_STORAGE_DOES_NOT_EXISTS;
- }
- } else {
- $this->output = JobError::MSG_ERROR_CLIENT_DOES_NOT_EXISTS;
- $this->error = JobError::ERROR_CLIENT_DOES_NOT_EXISTS;
- }
- } else {
- $this->output = JobError::MSG_ERROR_FILESET_DOES_NOT_EXISTS;
- $this->error = JobError::ERROR_FILESET_DOES_NOT_EXISTS;
- }
- } else {
- $this->output = JobError::MSG_ERROR_INVALID_JOBLEVEL;
- $this->error = JobError::ERROR_INVALID_JOBLEVEL;
- }
- } else {
+ if(is_null($job)) {
$this->output = JobError::MSG_ERROR_JOB_DOES_NOT_EXISTS;
$this->error = JobError::ERROR_JOB_DOES_NOT_EXISTS;
+ return;
}
+
+ $is_valid_level = $this->getModule('misc')->isValidJobLevel($params->level);
+ if(!$is_valid_level) {
+ $this->output = JobError::MSG_ERROR_INVALID_JOBLEVEL;
+ $this->error = JobError::ERROR_INVALID_JOBLEVEL;
+ return;
+ }
+
+ if(is_null($fileset)) {
+ $this->output = JobError::MSG_ERROR_FILESET_DOES_NOT_EXISTS;
+ $this->error = JobError::ERROR_FILESET_DOES_NOT_EXISTS;
+ return;
+ }
+
+ if(is_null($client)) {
+ $this->output = JobError::MSG_ERROR_CLIENT_DOES_NOT_EXISTS;
+ $this->error = JobError::ERROR_CLIENT_DOES_NOT_EXISTS;
+ return;
+ }
+
+ if(is_null($storage)) {
+ $this->output = JobError::MSG_ERROR_STORAGE_DOES_NOT_EXISTS;
+ $this->error = JobError::ERROR_STORAGE_DOES_NOT_EXISTS;
+ return;
+ }
+
+ if(is_null($pool)) {
+ $this->output = JobError::MSG_ERROR_POOL_DOES_NOT_EXISTS;
+ $this->error = JobError::ERROR_POOL_DOES_NOT_EXISTS;
+ return;
+ }
+
+ $joblevels = $this->getModule('misc')->getJobLevels();
+ $command = array(
+ 'run',
+ 'job="' . $job . '"',
+ 'level="' . $joblevels[$level] . '"',
+ 'fileset="' . $fileset . '"',
+ 'client="' . $client . '"',
+ 'storage="' . $storage . '"',
+ 'pool="' . $pool . '"' ,
+ 'priority="' . $priority . '"',
+ $jobid,
+ $verifyjob,
+ 'yes'
+ );
+ $run = $this->getModule('bconsole')->bconsoleCommand($this->director, $command);
+ $this->output = $run->output;
+ $this->error = $run->exitcode;
}
}
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
$error = false;
$error_obj = null;
- if (isset($this->Request['id'])) {
+ if ($this->Request->contains('id')) {
$jobid = intval($this->Request['id']);
$job = $this->getModule('job')->getJobById($jobid);
$jobname = property_exists($job, 'name') ? $job->name : null;
- } elseif (isset($this->Request['name'])) {
- $allowedJobs = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.jobs'), $this->user);
- if ($allowedJobs->exitcode === 0) {
- $jobname = in_array($this->Request['name'], $allowedJobs->output) ? $this->Request['name'] : null;
+ } elseif ($this->Request->contains('name')) {
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.jobs'));
+ if ($result->exitcode === 0) {
+ $jobname = in_array($this->Request['name'], $result->output) ? $this->Request['name'] : null;
} else {
- $error_obj = $allowedJobs;
+ $error_obj = $result;
$error = true;
}
}
if ($error === false) {
- if(!is_null($jobname)) {
- $jobShow = $this->getModule('bconsole')->bconsoleCommand($this->director, array('show', 'job="' . $jobname . '"'), $this->user);
- $this->output = $jobShow->output;
- $this->error = (integer)$jobShow->exitcode;
+ if(is_string($jobname)) {
+ $job_show = $this->getModule('bconsole')->bconsoleCommand(
+ $this->director,
+ array('show', 'job="' . $jobname . '"')
+ );
+ $this->output = $job_show->output;
+ $this->error = $job_show->exitcode;
} else {
$this->output = JobError::MSG_ERROR_JOB_DOES_NOT_EXISTS;
$this->error = JobError::ERROR_JOB_DOES_NOT_EXISTS;
}
}
}
-
?>
class JobTasks extends BaculumAPIServer {
public function get() {
- $limit = intval($this->Request['limit']);
+ $limit = $this->Request->contains('limit') ? intval($this->Request['limit']) : 0;
$jobs_cmd = array('.jobs');
if ($this->Request->contains('type') && array_key_exists($this->Request['type'], $this->getModule('misc')->job_types)) {
array_push($jobs_cmd, 'type="' . $this->Request['type']. '"');
}
$directors = $this->getModule('bconsole')->getDirectors();
- if($directors->exitcode === 0) {
- $jobs = array();
- $error = false;
- $error_obj = null;
- for($i = 0; $i < count($directors->output); $i++) {
- $jobsList = $this->getModule('bconsole')->bconsoleCommand($directors->output[$i], $jobs_cmd, $this->user);
- if ($jobsList->exitcode != 0) {
- $error_obj = $jobsList;
- $error = true;
- break;
- }
- $jobsshow = $this->getModule('bconsole')->bconsoleCommand($directors->output[$i], array('show', 'jobs'), $this->user);
- if ($jobsshow->exitcode != 0) {
- $error_obj = $jobsshow;
- $error = true;
- break;
- }
- $jobs[$directors->output[$i]] = array();
- for($j = 0; $j < count($jobsList->output); $j++) {
- /**
- * Checking by "show job" command is ugly way to be sure that is reading jobname but not some
- * random output (eg. "You have messages." or debugging).
- * For now I did not find nothing better for be sure that output contains job.
- */
- for($k = 0; $k < count($jobsshow->output); $k++) {
- if(preg_match('/^Job: name=' . $jobsList->output[$j] . '.*/', $jobsshow->output[$k]) === 1) {
- $jobs[$directors->output[$i]][] = $jobsList->output[$j];
- break;
- }
- }
- // limit per director, not for entire elements
- if($limit > 0 && count($jobs[$directors->output[$i]]) === $limit) {
+ if($directors->exitcode != 0) {
+ $this->output = $directors->output;
+ $this->error = $directors->exitcode;
+ return;
+ }
+ $jobs = array();
+ $error = false;
+ $error_obj = null;
+ for($i = 0; $i < count($directors->output); $i++) {
+ $job_list = $this->getModule('bconsole')->bconsoleCommand($directors->output[$i], $jobs_cmd);
+ if ($job_list->exitcode != 0) {
+ $error_obj = $job_list;
+ $error = true;
+ break;
+ }
+ $jobs_show = $this->getModule('bconsole')->bconsoleCommand($directors->output[$i], array('show', 'jobs'));
+ if ($jobs_show->exitcode != 0) {
+ $error_obj = $jobs_show;
+ $error = true;
+ break;
+ }
+ $jobs[$directors->output[$i]] = array();
+ for($j = 0; $j < count($job_list->output); $j++) {
+ /**
+ * Checking by "show job" command is ugly way to be sure that is reading jobname but not some
+ * random output (eg. "You have messages." or debugging).
+ * For now I did not find nothing better for be sure that output contains job.
+ */
+ for($k = 0; $k < count($jobs_show->output); $k++) {
+ if(preg_match('/^Job: name=' . $job_list->output[$j] . '.*/', $jobs_show->output[$k]) === 1) {
+ $jobs[$directors->output[$i]][] = $job_list->output[$j];
break;
}
}
+ // limit per director, not for entire elements
+ if($limit > 0 && count($jobs[$directors->output[$i]]) === $limit) {
+ break;
+ }
}
- if ($error === true) {
- $this->output = $error_obj->output;
- $this->error = $error_obj->exitcode;
- } else {
- $this->output = $jobs;
- $this->error = BconsoleError::ERROR_NO_ERRORS;
- }
+ }
+ if ($error === true) {
+ $this->output = $error_obj->output;
+ $this->error = $error_obj->exitcode;
} else {
- $this->output = $directors->output;
- $this->error = $directors->exitcode;
+ $this->output = $jobs;
+ $this->error = BconsoleError::ERROR_NO_ERRORS;
}
}
}
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
public function get() {
$error = false;
$allowed = array();
- if (!is_null($this->user)) {
- $allowedJobs = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.jobs'), $this->user);
- if ($allowedJobs->exitcode === 0) {
- array_shift($allowedJobs->output);
- $allowed = $allowedJobs->output;
- } else {
- $error = true;
- $this->output = $allowedJobs->output;
- $this->error = $allowedJobs->error;
- }
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.jobs'));
+ if ($result->exitcode === 0) {
+ array_shift($result->output);
+ $allowed = $result->output;
+ } else {
+ $error = true;
+ $this->output = $result->output;
+ $this->error = $result->error;
}
if ($error === false) {
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class Jobs extends BaculumAPIServer {
public function get() {
- $limit = intval($this->Request['limit']);
+ $limit = $this->Request->contains('limit') ? intval($this->Request['limit']) : 0;
$allowed = array();
- $allowedJobs = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.jobs'), $this->user);
- if ($allowedJobs->exitcode === 0) {
- array_shift($allowedJobs->output);
- $allowed = $allowedJobs->output;
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.jobs'));
+ if ($result->exitcode === 0) {
+ array_shift($result->output);
+ $allowed = $result->output;
$jobs = $this->getModule('job')->getJobs($limit, $allowed);
$this->output = $jobs;
$this->error = JobError::ERROR_NO_ERRORS;
} else {
- $this->output = $allowedJobs->output;
- $this->error = $allowedJobs->exitcode;
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
}
}
}
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
*/
class JobsForClient extends BaculumAPIServer {
+
public function get() {
- $allowed = array();
- $clientid = intval($this->Request['id']);
+ $allowed_jobs = array();
+ $clientid = $this->Request->contains('id') ? intval($this->Request['id']) : 0;
$error = false;
- if (!is_null($this->user)) {
- $allowed_jobs = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.jobs'), $this->user);
- if ($allowed_jobs->exitcode === 0) {
- $allowed = $allowed_jobs->output;
- } else {
- $error = true;
- $this->output = $allowed_jobs->output;
- $this->error = $allowed_jobs->exitcode;
- }
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.jobs'));
+ if ($result->exitcode === 0) {
+ $allowed_jobs = $result->output;
+ } else {
+ $error = true;
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
}
if ($error === false) {
- $jobs = $this->getModule('job')->getJobsForClient($clientid, $allowed);
+ $jobs = $this->getModule('job')->getJobsForClient($clientid, $allowed_jobs);
$this->output = $jobs;
$this->error = JobError::ERROR_NO_ERRORS;
}
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class JobsOnVolume extends BaculumAPIServer {
public function get() {
$allowed = array();
- $mediaid = intval($this->Request['id']);
+ $mediaid = $this->Request->contains('id') ? intval($this->Request['id']) : 0;
$error = false;
- if (!is_null($this->user)) {
- $allowed_jobs = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.jobs'), $this->user);
- if ($allowed_jobs->exitcode === 0) {
- $allowed = $allowed_jobs->output;
- } else {
- $error = true;
- $this->output = $allowed_jobs->output;
- $this->error = $allowed_jobs->exitcode;
- }
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.jobs'));
+ if ($result->exitcode === 0) {
+ $allowed = $result->output;
+ } else {
+ $error = true;
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
}
if ($error === false) {
class JobsRecent extends BaculumAPIServer {
public function get() {
- $jobname = $this->Request['name'];
+ $jobname = $this->Request->contains('name') ? $this->Request['name'] : '';
$clientid = null;
if ($this->Request->contains('clientid')) {
$clientid = intval($this->Request['clientid']);
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class JobsShow extends BaculumAPIServer {
public function get() {
- $jobs = $this->getModule('bconsole')->bconsoleCommand($this->director, array('show', 'jobs'), $this->user);
- $this->output = $jobs->output;
- $this->error = (integer)$jobs->exitcode;
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, array('show', 'jobs'));
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
}
}
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class Pool extends BaculumAPIServer {
public function get() {
- $poolid = intval($this->Request['id']);
+ $poolid = $this->Request->contains('id') ? intval($this->Request['id']) : 0;
$pool = $this->getModule('pool')->getPoolById($poolid);
- $allowedPools = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.pool'), $this->user);
+ $allowedPools = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.pool'));
if ($allowedPools->exitcode === 0) {
if(!is_null($pool) && in_array($pool->name, $allowedPools->output)) {
$this->output = $pool;
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class PoolShow extends BaculumAPIServer {
public function get() {
- $poolid = intval($this->Request['id']);
+ $poolid = $this->Request->contains('id') ? intval($this->Request['id']) : 0;
$pool = $this->getModule('pool')->getPoolById($poolid);
- if(!is_null($pool)) {
- $poolShow = $this->getModule('bconsole')->bconsoleCommand($this->director, array('show', 'pool="' . $pool->name . '"'), $this->user);
- $this->output = $poolShow->output;
- $this->error = (integer)$poolShow->exitcode;
+ if (is_object($pool)) {
+ $result = $this->getModule('bconsole')->bconsoleCommand(
+ $this->director,
+ array('show', 'pool="' . $pool->name . '"')
+ );
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
} else {
$this->output = PoolError::MSG_ERROR_POOL_DOES_NOT_EXISTS;
$this->error = PoolError::ERROR_POOL_DOES_NOT_EXISTS;
}
}
-?>
\ No newline at end of file
+?>
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class PoolUpdate extends BaculumAPIServer {
public function set($id, $params) {
- $pool = $this->getModule('pool')->getPoolById($id);
- if(!is_null($pool)) {
- $poolUpdate = $this->getModule('bconsole')->bconsoleCommand($this->director, array('update', 'pool="' . $pool->name . '"'), $this->user);
- $this->output = $poolUpdate->output;
- $this->error = (integer)$poolUpdate->exitcode;
+ $poolid = intval($id);
+ $pool = $this->getModule('pool')->getPoolById($poolid);
+ if(is_object($pool)) {
+ $result = $this->getModule('bconsole')->bconsoleCommand(
+ $this->director,
+ array('update', 'pool="' . $pool->name . '"')
+ );
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
} else {
$this->output = PoolError::MSG_ERROR_POOL_DOES_NOT_EXISTS;
$this->error = PoolError::ERROR_POOL_DOES_NOT_EXISTS;
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class PoolUpdateVolumes extends BaculumAPIServer {
public function set($id, $params) {
- $pool = $this->getModule('pool')->getPoolById($id);
- if(!is_null($pool)) {
+ $poolid = intval($id);
+ $pool = $this->getModule('pool')->getPoolById($poolid);
+ if(is_object($pool)) {
$voldata = $this->getModule('volume')->getVolumesByPoolId($pool->poolid);
- if(!is_null($voldata)) {
- $poolUpdateVolumes = $this->getModule('bconsole')->bconsoleCommand($this->director, array('update', 'volume="' . $voldata->volumename . '"', 'allfrompool="' . $pool->name . '"'), $this->user);
- $this->output = $poolUpdateVolumes->output;
- $this->error = (integer)$poolUpdateVolumes->exitcode;
+ if(is_object($voldata)) {
+ $result = $this->getModule('bconsole')->bconsoleCommand(
+ $this->director,
+ array('update', 'volume="' . $voldata->volumename . '"', 'allfrompool="' . $pool->name . '"')
+ );
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
} else {
$this->output = PoolError::MSG_ERROR_NO_VOLUMES_IN_POOL_TO_UPDATE;
$this->error = PoolError::ERROR_NO_VOLUMES_IN_POOL_TO_UPDATE;
}
}
-?>
\ No newline at end of file
+?>
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class Pools extends BaculumAPIServer {
public function get() {
- $limit = intval($this->Request['limit']);
+ $limit = $this->Request->contains('limit') ? intval($this->Request['limit']) : 0;
$pools = $this->getModule('pool')->getPools($limit);
- $allowedPools = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.pool'), $this->user);
- if ($allowedPools->exitcode === 0) {
- $poolsOutput = array();
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.pool'));
+ if ($result->exitcode === 0) {
+ $pools_output = array();
foreach($pools as $pool) {
- if(in_array($pool->name, $allowedPools->output)) {
- $poolsOutput[] = $pool;
+ if(in_array($pool->name, $result->output)) {
+ $pools_output[] = $pool;
}
}
- $this->output = $poolsOutput;
+ $this->output = $pools_output;
$this->error = PoolError::ERROR_NO_ERRORS;
} else {
- $this->output = $allowedPools->output;
- $this->error = $allowedPools->exitcode;
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
}
}
}
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class PoolsShow extends BaculumAPIServer {
public function get() {
- $pools = $this->getModule('bconsole')->bconsoleCommand($this->director, array('show', 'pools'), $this->user);
- $this->output = $pools->output;
- $this->error = (integer)$pools->exitcode;
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, array('show', 'pools'));
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
}
}
?>
}
$command[] = 'yes';
- $restore = $this->getModule('bconsole')->bconsoleCommand($this->director, $command, $this->user);
+ $restore = $this->getModule('bconsole')->bconsoleCommand($this->director, $command);
$this->removeTmpRestoreTable($rfile);
$this->output = $restore->output;
- $this->error = (integer)$restore->exitcode;
+ $this->error = $restore->exitcode;
}
private function removeTmpRestoreTable($tableName) {
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class Storage extends BaculumAPIServer {
public function get() {
- $storageid = intval($this->Request['id']);
+ $storageid = $this->Request->contains('id') ? intval($this->Request['id']) : 0;
$storage = $this->getModule('storage')->getStorageById($storageid);
- $allowedStorages = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.storage'), $this->user);
- if ($allowedStorages->exitcode === 0) {
- if(!is_null($storage) && in_array($storage->name, $allowedStorages->output)) {
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.storage'));
+ if ($result->exitcode === 0) {
+ if(!is_null($storage) && in_array($storage->name, $result->output)) {
$this->output = $storage;
$this->error = StorageError::ERROR_NO_ERRORS;
} else {
$this->error = StorageError::ERROR_STORAGE_DOES_NOT_EXISTS;
}
} else {
- $this->output = $allowedStorages->output;
- $this->error = $allowedStorages->exitcode;
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
}
}
}
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class StorageMount extends BaculumAPIServer {
public function get() {
- $storageid = intval($this->Request['id']);
- $drive = intval($this->Request['drive']);
- $slot = intval($this->Request['slot']);
+ $storageid = $this->Request->contains('id') ? intval($this->Request['id']) : 0;
+ $drive = $this->Request->contains('drive') ? intval($this->Request['drive']) : 0;
+ $slot = $this->Request->contains('slot') ? intval($this->Request['slot']) : 0;
$storage = $this->getModule('storage')->getStorageById($storageid);
- if(!is_null($storage)) {
- $storageMount = $this->getModule('bconsole')->bconsoleCommand($this->director, array('mount', 'storage="' . $storage->name . '"', 'drive=' . $drive, 'slot=' . $slot), $this->user);
- $this->output = $storageMount->output;
- $this->error = (integer)$storageMount->exitcode;
+ if(is_object($storage)) {
+ $result = $this->getModule('bconsole')->bconsoleCommand(
+ $this->director,
+ array('mount', 'storage="' . $storage->name . '"', 'drive=' . $drive, 'slot=' . $slot)
+ );
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
} else {
$this->output = StorageError::MSG_ERROR_STORAGE_DOES_NOT_EXISTS;
$this->error = StorageError::ERROR_STORAGE_DOES_NOT_EXISTS;
}
}
-?>
\ No newline at end of file
+?>
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class StorageRelease extends BaculumAPIServer {
public function get() {
- $storageid = intval($this->Request['id']);
- $drive = intval($this->Request['drive']);
-
+ $storageid = $this->Request->contains('id') ? intval($this->Request['id']) : 0;
+ $drive = $this->Request->contains('drive') ? intval($this->Request['drive']) : 0;
$storage = $this->getModule('storage')->getStorageById($storageid);
- if(!is_null($storage)) {
- $storageRelease = $this->getModule('bconsole')->bconsoleCommand($this->director, array('release', 'storage="' . $storage->name . '"', 'drive="' . $drive . '"'), $this->user);
- $this->output = $storageRelease->output;
- $this->error = (integer)$storageRelease->exitcode;
+ if (is_object($storage)) {
+ $result = $this->getModule('bconsole')->bconsoleCommand(
+ $this->director,
+ array('release', 'storage="' . $storage->name . '"', 'drive="' . $drive . '"')
+ );
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
} else {
$this->output = StorageError::MSG_ERROR_STORAGE_DOES_NOT_EXISTS;
$this->error = StorageError::ERROR_STORAGE_DOES_NOT_EXISTS;
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class StorageShow extends BaculumAPIServer {
public function get() {
- $storageid = intval($this->Request['id']);
+ $storageid = $this->Request->contains('id') ? intval($this->Request['id']) : 0;
$storage = $this->getModule('storage')->getStorageById($storageid);
- if(!is_null($storage)) {
- $storageShow = $this->getModule('bconsole')->bconsoleCommand($this->director, array('show', 'storage="' . $storage->name . '"'), $this->user);
- $this->output = $storageShow->output;
- $this->error = (integer)$storageShow->exitcode;
+ if(is_object($storage)) {
+ $result = $this->getModule('bconsole')->bconsoleCommand(
+ $this->director,
+ array('show', 'storage="' . $storage->name . '"')
+ );
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
} else {
$this->output = StorageError::MSG_ERROR_STORAGE_DOES_NOT_EXISTS;
$this->error = StorageError::ERROR_STORAGE_DOES_NOT_EXISTS;
}
}
-?>
\ No newline at end of file
+?>
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class StorageStatus extends BaculumAPIServer {
public function get() {
- $storageid = intval($this->Request['id']);
+ $storageid = $this->Request->contains('id') ? intval($this->Request['id']) : 0;
$storage = $this->getModule('storage')->getStorageById($storageid);
- if(!is_null($storage)) {
- $storageStatus = $this->getModule('bconsole')->bconsoleCommand($this->director, array('status', 'storage="' . $storage->name . '"'), $this->user);
- $this->output = $storageStatus->output;
- $this->error = (integer)$storageStatus->exitcode;
+ if(is_object($storage)) {
+ $result = $this->getModule('bconsole')->bconsoleCommand(
+ $this->director,
+ array('status', 'storage="' . $storage->name . '"')
+ );
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
} else {
$this->output = StorageError::MSG_ERROR_STORAGE_DOES_NOT_EXISTS;
$this->error = StorageError::ERROR_STORAGE_DOES_NOT_EXISTS;
}
}
-?>
\ No newline at end of file
+?>
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class StorageUmount extends BaculumAPIServer {
public function get() {
- $storageid = intval($this->Request['id']);
- $drive = intval($this->Request['drive']);
+ $storageid = $this->Request->contains('id') ? intval($this->Request['id']) : 0;
+ $drive = $this->Request->contains('drive') ? intval($this->Request['drive']) : 0;
$storage = $this->getModule('storage')->getStorageById($storageid);
- if(!is_null($storage)) {
- $storageUmount = $this->getModule('bconsole')->bconsoleCommand($this->director, array('umount', 'storage="' . $storage->name . '"', 'drive=' . $drive), $this->user);
- $this->output = $storageUmount->output;
- $this->error = (integer)$storageUmount->exitcode;
+ if (is_object($storage)) {
+ $result = $this->getModule('bconsole')->bconsoleCommand(
+ $this->director,
+ array('umount', 'storage="' . $storage->name . '"', 'drive=' . $drive)
+ );
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
} else {
$this->output = StorageError::MSG_ERROR_STORAGE_DOES_NOT_EXISTS;
$this->error = StorageError::ERROR_STORAGE_DOES_NOT_EXISTS;
}
}
-?>
\ No newline at end of file
+?>
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class Storages extends BaculumAPIServer {
public function get() {
- $limit = intval($this->Request['limit']);
+ $limit = $this->Request->contains('limit') ? intval($this->Request['limit']) : 0;
$storages = $this->getModule('storage')->getStorages($limit);
- $allowedStorages = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.storage'), $this->user);
- if ($allowedStorages->exitcode === 0) {
- $storagesOutput = array();
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, array('.storage'));
+ if ($result->exitcode === 0) {
+ $storages_output = array();
foreach($storages as $storage) {
- if(in_array($storage->name, $allowedStorages->output)) {
- $storagesOutput[] = $storage;
+ if(in_array($storage->name, $result->output)) {
+ $storages_output[] = $storage;
}
}
- $this->output = $storagesOutput;
+ $this->output = $storages_output;
$this->error = StorageError::ERROR_NO_ERRORS;
} else {
- $this->output = $allowedStorages->output;
- $this->error = $allowedStorages->exitcode;
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
}
}
}
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class StoragesShow extends BaculumAPIServer {
public function get() {
- $storages = $this->getModule('bconsole')->bconsoleCommand($this->director, array('show', 'storages'), $this->user);
- $this->output = $storages->output;
- $this->error = (integer)$storages->exitcode;
+ $result = $this->getModule('bconsole')->bconsoleCommand($this->director, array('show', 'storages'));
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
}
}
?>
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class Volume extends BaculumAPIServer {
public function get() {
- $mediaid = intval($this->Request['id']);
+ $mediaid = $this->Request->contains('id') ? intval($this->Request['id']) : 0;
$volume = $this->getModule('volume')->getVolumeById($mediaid);
- if(!is_null($volume)) {
+ if(is_object($volume)) {
$this->output = $volume;
$this->error = VolumeError::ERROR_NO_ERRORS;
} else {
public function set($id, $params) {
$volume = $this->getModule('volume')->getVolumeById($id);
if (is_object($volume)) {
+ $misc = $this->getModule('misc');
$cmd = array('update', 'volume="' . $volume->volumename . '"');
- if(property_exists($params, 'volstatus')) {
+ if(property_exists($params, 'volstatus') && $misc->isValidState($params->volstatus)) {
$cmd[] = 'volstatus="' . $params->volstatus . '"';
}
- if(property_exists($params, 'poolid')) {
+ if(property_exists($params, 'poolid') && $misc->isValidId($params->poolid)) {
$pool = $this->getModule('pool')->getPoolById($params->poolid);
if (is_object($pool)) {
$cmd[] = 'pool="' . $pool->name . '"';
}
}
- if(property_exists($params, 'volretention')) {
+ if(property_exists($params, 'volretention') && $misc->isValidNumber($params->volretention)) {
$cmd[] = 'volretention="' . $params->volretention . '"';
}
- if(property_exists($params, 'voluseduration')) {
+ if(property_exists($params, 'voluseduration') && $misc->isValidNumber($params->voluseduration)) {
$cmd[] = 'voluseduration="' . $params->voluseduration . '"';
}
- if(property_exists($params, 'maxvoljobs')) {
+ if(property_exists($params, 'maxvoljobs') && $misc->isValidNumber($params->maxvoljobs)) {
$cmd[] = 'maxvoljobs="' . $params->maxvoljobs . '"';
}
- if(property_exists($params, 'maxvolfiles')) {
+ if(property_exists($params, 'maxvolfiles') && $misc->isValidNumber($params->maxvolfiles)) {
$cmd[] = 'maxvolfiles="' . $params->maxvolfiles . '"';
}
- if(property_exists($params, 'maxvolbytes')) {
+ if(property_exists($params, 'maxvolbytes') && $misc->isValidNumber($params->maxvolbytes)) {
$cmd[] = 'maxvolbytes="' . $params->maxvolbytes . '"';
}
- if(property_exists($params, 'slot')) {
+ if(property_exists($params, 'slot') && $misc->isValidNumber($params->slot)) {
$cmd[] = 'slot="' . $params->slot . '"';
}
- if(property_exists($params, 'recycle')) {
+ if(property_exists($params, 'recycle') && $misc->isValidBoolean($params->recycle)) {
$cmd[] = 'recycle="' . ($params->recycle ? 'yes' : 'no') . '"';
}
- if(property_exists($params, 'enabled')) {
+ if(property_exists($params, 'enabled') && $misc->isValidBoolean($params->enabled)) {
$cmd[] = 'enabled="' . ($params->enabled ? 'yes' : 'no') . '"';
}
- if(property_exists($params, 'inchanger')) {
+ if(property_exists($params, 'inchanger') && $misc->isValidBoolean($params->inchanger)) {
$cmd[] = 'inchanger="' . ($params->inchanger ? 'yes' : 'no') . '"';
}
$result = $this->getModule('bconsole')->bconsoleCommand($this->director, $cmd);
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class VolumePrune extends BaculumAPIServer {
public function get() {
- $mediaid = intval($this->Request['id']);
+ $mediaid = $this->Request->contains('id') ? intval($this->Request['id']) : 0;
$volume = $this->getModule('volume')->getVolumeById($mediaid);
- if(!is_null($volume)) {
- $prune = $this->getModule('bconsole')->bconsoleCommand($this->director, array('prune', 'volume="' . $volume->volumename . '"', 'yes'), $this->user);
- $this->output = $prune->output;
- $this->error = (integer)$prune->exitcode;
+ if(is_object($volume)) {
+ $result = $this->getModule('bconsole')->bconsoleCommand(
+ $this->director,
+ array('prune', 'volume="' . $volume->volumename . '"', 'yes')
+ );
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
} else {
$this->output = VolumeError::MSG_ERROR_VOLUME_DOES_NOT_EXISTS;
$this->error = VolumeError::ERROR_VOLUME_DOES_NOT_EXISTS;
}
}
-?>
\ No newline at end of file
+?>
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class VolumePurge extends BaculumAPIServer {
public function get() {
- $mediaid = intval($this->Request['id']);
+ $mediaid = $this->Request->contains('id') ? intval($this->Request['id']) : 0;
$volume = $this->getModule('volume')->getVolumeById($mediaid);
- if(!is_null($volume)) {
- $purge = $this->getModule('bconsole')->bconsoleCommand($this->director, array('purge', 'volume="' . $volume->volumename . '"', 'yes'), $this->user);
- $this->output = $purge->output;
- $this->error = (integer)$purge->exitcode;
+ if(is_object($volume)) {
+ $result = $this->getModule('bconsole')->bconsoleCommand(
+ $this->director,
+ array('purge', 'volume="' . $volume->volumename . '"', 'yes')
+ );
+ $this->output = $result->output;
+ $this->error = $result->exitcode;
} else {
$this->output = VolumeError::MSG_ERROR_VOLUME_DOES_NOT_EXISTS;
$this->error = VolumeError::ERROR_VOLUME_DOES_NOT_EXISTS;
}
}
}
-
-?>
\ No newline at end of file
+?>
* Bacula(R) - The Network Backup Solution
* Baculum - Bacula web interface
*
- * Copyright (C) 2013-2016 Kern Sibbald
+ * Copyright (C) 2013-2017 Kern Sibbald
*
* The main author of Baculum is Marcin Haba.
* The original author of Bacula is Kern Sibbald, with contributions
class Volumes extends BaculumAPIServer {
public function get() {
- $limit = intval($this->Request['limit']);
- $volumes = $this->getModule('volume')->getVolumes($limit);
- $this->output = $volumes;
+ $limit = $this->Request->contains('limit') ? intval($this->Request['limit']) : 0;
+ $result = $this->getModule('volume')->getVolumes($limit);
+ $this->output = $result;
$this->error = VolumeError::ERROR_NO_ERRORS;
}
}
const ERROR_BCONSOLE_CONNECTION_PROBLEM = 4;
const ERROR_INVALID_DIRECTOR = 5;
+ const ERROR_BCONSOLE_DISABLED = 11;
const MSG_ERROR_BCONSOLE_CONNECTION_PROBLEM = 'Problem with connection to bconsole.';
const MSG_ERROR_INVALID_DIRECTOR = 'Invalid director.';
+ const MSG_ERROR_BCONSOLE_DISABLED = 'Bconsole support is disabled.';
}
class AuthorizationError extends GenericError {
}
class BVFSError extends GenericError {
- const ERROR_INVALID_JOBID_LIST = 70;
const ERROR_INVALID_RPATH = 71;
const ERROR_INVALID_RESTORE_PATH = 72;
- const ERROR_INVALID_FILEID_LIST = 73;
- const ERROR_INVALID_FILEINDEX_LIST = 74;
- const ERROR_INVALID_DIRID_LIST = 75;
+ const ERROR_INVALID_JOBID_LIST = 73;
+ const ERROR_INVALID_FILEID_LIST = 74;
+ const ERROR_INVALID_FILEINDEX_LIST = 75;
+ const ERROR_INVALID_DIRID_LIST = 76;
+ const ERROR_INVALID_CLIENT = 77;
- const MSG_ERROR_INVALID_JOBID_LIST = 'Invalid jobid list.';
const MSG_ERROR_INVALID_RPATH = 'Inputted path for restore is invalid. Proper format is b2[0-9]+.';
const MSG_ERROR_INVALID_RESTORE_PATH = 'Inputted BVFS path param is invalid.';
+ const MSG_ERROR_INVALID_JOBID_LIST = 'Invalid jobid list.';
const MSG_ERROR_INVALID_FILEID_LIST = 'Invalid fileid list.';
const MSG_ERROR_INVALID_FILEINDEX_LIST = 'Invalid file index list.';
const MSG_ERROR_INVALID_DIRID_LIST = 'Invalid dirid list.';
+ const MSG_ERROR_INVALID_CLIENT = 'Invalid client name.';
}
class JSONToolsError extends GenericError {