Skip to content

Commit

Permalink
Update RestoreModel.php
Browse files Browse the repository at this point in the history
There's a situation where if $mergefilesets==0 and $mergejobs==1, the $cmd variable isn't set and code is executed, leading into an error trying to get jobids. The user shouldn't be able to select this situation, but I have tried this, and it can happen.
I'm proposing a change in the if-structure so that $cmd is always correctly set.
  • Loading branch information
samverstraete authored and fbergkemper committed Jan 23, 2017
1 parent a922dec commit 99cd371
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions module/Restore/src/Restore/Model/RestoreModel.php
Expand Up @@ -91,15 +91,15 @@ public function getFiles(&$bsock=null, $jobid=null, $pathid=null) {
public function getJobIds(&$bsock=null, $jobid=null, $mergefilesets=0, $mergejobs=0)
{
if(isset($bsock)) {
if($mergefilesets == 0 && $mergejobs == 0) {
if($mergefilesets == 1 && $mergejobs == 1) {
return $jobid;
}
if($mergefilesets == 0) {
$cmd = '.bvfs_get_jobids jobid='.$jobid.' all';
}
elseif($mergefilesets == 1 && $mergejobs == 0) {
else {
$cmd = '.bvfs_get_jobids jobid='.$jobid.'';
}
elseif($mergefilesets == 1 && $mergejobs == 1) {
return $jobid;
}
$result = $bsock->send_command($cmd, 2, null);
$jobids = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
if(!empty($jobids['result'])) {
Expand Down

0 comments on commit 99cd371

Please sign in to comment.