Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/bareos/bareos-webui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Bergkemper <frank.bergkemper@bareos.com>2018-01-04 19:13:06 +0300
committerFrank Bergkemper <frank.bergkemper@bareos.com>2018-01-04 19:13:06 +0300
commita562e5fee9adc19ebdec86c4f75f9ee6bd7f5d86 (patch)
treed368598356b34cf393f7ea0eb29c027f39caa4be
parenteac1f95f116882471cc24049ca7a06d1764ff582 (diff)
Fix to bugreport #887
The newly introduced looping through the result set continues looping until it receives the full result. There was a case that lead to an endless loop, if the BVFS API delivers a rubish result. Fixes #887: Restore file list taking 20 minutes to populate
-rw-r--r--CHANGELOG.md1
-rw-r--r--module/Restore/src/Restore/Model/RestoreModel.php4
2 files changed, 3 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index bcfe898..05fc673 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
### Changed
+- Fix to bugreport #887
### Removed
diff --git a/module/Restore/src/Restore/Model/RestoreModel.php b/module/Restore/src/Restore/Model/RestoreModel.php
index 8af494c..054263e 100644
--- a/module/Restore/src/Restore/Model/RestoreModel.php
+++ b/module/Restore/src/Restore/Model/RestoreModel.php
@@ -64,7 +64,7 @@ class RestoreModel
$cmd_2 = '.bvfs_lsdirs jobid='.$jobid.' path=@ limit='.$limit;
$result = $bsock->send_command($cmd_2, 2, $jobid);
$directories = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
- if(count($directories['result']['directories']) == 2) {
+ if(count($directories['result']['directories']) <= 2) {
$retval = array_merge($retval, $directories['result']['directories']);
// as . and .. are always returned, filter possible duplicates of . and .. (current and parent dir)
foreach($retval as $key => $value) {
@@ -78,7 +78,7 @@ class RestoreModel
}
}
// no more results?
- elseif (count($directories['result']['directories']) == 2) {
+ elseif (count($directories['result']['directories']) <= 2) {
$retval = array_merge($retval, $directories['result']['directories']);
// as . and .. are always returned, filter possible duplicates of . and .. (current and parent dir)
foreach($retval as $key => $value) {