Navigation Menu

Skip to content

Commit

Permalink
Restore: Bugfix
Browse files Browse the repository at this point in the history
An exception has been thrown when no jobids for a specific client were available.

This patch allows an emtpy jobid if no backup jobs are available.

We just drop the jobid argument from isset(), so the argument list is correct
in case of not given jobid, by that the exception is no longer thrown.

Also we no longer try to retrieve related jobids via bvfs api for a not given jobid
which lead to unnecessary load on dird. In this case $jobids, $files and
$directories is immediatly set to null.

Note: bfvs_get_jobids needs at least one jobid to retrieve related jobids for a most
recent restore.
  • Loading branch information
fbergkemper committed Jul 26, 2016
1 parent a0dd338 commit fdcbd9d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
24 changes: 18 additions & 6 deletions module/Restore/src/Restore/Controller/RestoreController.php
Expand Up @@ -228,9 +228,15 @@ private function buildSubtree()
// Get directories
try {
if($this->restore_params['type'] == "client") {
$jobids = $this->getRestoreModel()->getJobIds($this->bsock, $this->restore_params['jobid'],$this->restore_params['mergefilesets'],$this->restore_params['mergejobs']);
$this->restore_params['jobids'] = $jobids;
$directories = $this->getRestoreModel()->getDirectories($this->bsock, $this->restore_params['jobids'],$this->restore_params['id']);
if(empty($this->restore_params['jobid'])) {
$this->restore_params['jobids'] = null;
$directories = null;
}
else {
$jobids = $this->getRestoreModel()->getJobIds($this->bsock, $this->restore_params['jobid'],$this->restore_params['mergefilesets'],$this->restore_params['mergejobs']);
$this->restore_params['jobids'] = $jobids;
$directories = $this->getRestoreModel()->getDirectories($this->bsock, $this->restore_params['jobids'],$this->restore_params['id']);
}
}
else {
$directories = $this->getRestoreModel()->getDirectories($this->bsock, $this->restore_params['jobid'],$this->restore_params['id']);
Expand All @@ -243,9 +249,15 @@ private function buildSubtree()
// Get files
try {
if($this->restore_params['type'] == "client") {
$jobids = $this->getRestoreModel()->getJobIds($this->bsock, $this->restore_params['jobid'],$this->restore_params['mergefilesets'],$this->restore_params['mergejobs']);
$this->restore_params['jobids'] = $jobids;
$files = $this->getRestoreModel()->getFiles($this->bsock, $this->restore_params['jobids'],$this->restore_params['id']);
if(empty($this->restore_params['jobid'])) {
$this->restore_params['jobids'] = null;
$files = null;
}
else {
$jobids = $this->getRestoreModel()->getJobIds($this->bsock, $this->restore_params['jobid'],$this->restore_params['mergefilesets'],$this->restore_params['mergejobs']);
$this->restore_params['jobids'] = $jobids;
$files = $this->getRestoreModel()->getFiles($this->bsock, $this->restore_params['jobids'],$this->restore_params['id']);
}
}
else {
$files = $this->getRestoreModel()->getFiles($this->bsock, $this->restore_params['jobid'],$this->restore_params['id']);
Expand Down
6 changes: 3 additions & 3 deletions module/Restore/src/Restore/Model/RestoreModel.php
Expand Up @@ -29,7 +29,7 @@ class RestoreModel
{

public function getDirectories(&$bsock=null, $jobid=null, $pathid=null) {
if(isset($bsock, $jobid)) {
if(isset($bsock)) {
if($pathid == null || $pathid== "#") {
$cmd = '.bvfs_lsdirs jobid='.$jobid.' path=';
}
Expand Down Expand Up @@ -59,7 +59,7 @@ public function getDirectories(&$bsock=null, $jobid=null, $pathid=null) {
}

public function getFiles(&$bsock=null, $jobid=null, $pathid=null) {
if(isset($bsock, $jobid)) {
if(isset($bsock)) {
if($pathid == null || $pathid == "#") {
$cmd = '.bvfs_lsfiles jobid='.$jobid.' path=';
}
Expand Down Expand Up @@ -170,7 +170,7 @@ public function getRestoreJobs(&$bsock=null)

public function getJobIds(&$bsock=null, $jobid=null, $mergefilesets=0, $mergejobs=0)
{
if(isset($bsock, $jobid)) {
if(isset($bsock)) {
if($mergefilesets == 0 && $mergejobs == 0) {
$cmd = '.bvfs_get_jobids jobid='.$jobid.' all';
}
Expand Down

0 comments on commit fdcbd9d

Please sign in to comment.