From: Marcin Haba Date: Sat, 2 Feb 2019 05:32:12 +0000 (+0100) Subject: baculum: Add .bvfs_cleanup support to API X-Git-Tag: Release-9.4.2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=250dde3ee799cd630da9efb8249439f4ac0afad3;p=thirdparty%2Fbacula.git baculum: Add .bvfs_cleanup support to API --- diff --git a/gui/baculum/protected/API/Class/Bconsole.php b/gui/baculum/protected/API/Class/Bconsole.php index c5a0b6b81..ae9348a02 100644 --- a/gui/baculum/protected/API/Class/Bconsole.php +++ b/gui/baculum/protected/API/Class/Bconsole.php @@ -55,6 +55,7 @@ class Bconsole extends APIModule { '.bvfs_get_jobids', '.bvfs_restore', '.bvfs_clear_cache', + '.bvfs_cleanup', 'restore', 'cancel', 'delete', diff --git a/gui/baculum/protected/API/Pages/API/BVFSCleanUp.php b/gui/baculum/protected/API/Pages/API/BVFSCleanUp.php new file mode 100644 index 000000000..e413b9a23 --- /dev/null +++ b/gui/baculum/protected/API/Pages/API/BVFSCleanUp.php @@ -0,0 +1,41 @@ +getModule('misc'); + $path = property_exists($params, 'path') ? $params->path : null; + + if (is_null($path) || !$misc->isValidBvfsPath($path)) { + $this->output = BVFSError::MSG_ERROR_INVALID_RPATH; + $this->error = BVFSError::ERROR_INVALID_RPATH; + return; + } + + $cmd = array('.bvfs_cleanup', 'path="' . $path . '"'); + $result = $this->getModule('bconsole')->bconsoleCommand($this->director, $cmd); + $this->output = $result->output; + $this->error = $result->exitcode; + } +} +?> diff --git a/gui/baculum/protected/API/endpoints.xml b/gui/baculum/protected/API/endpoints.xml index 6f59adcb5..4b6ec392f 100644 --- a/gui/baculum/protected/API/endpoints.xml +++ b/gui/baculum/protected/API/endpoints.xml @@ -69,6 +69,7 @@ +