made difftaskservice progressCallback optional
This commit is contained in:
parent
a0b6a25508
commit
fb1290e671
1 changed files with 11 additions and 10 deletions
|
@ -53,7 +53,7 @@ class DiffTaskService {
|
|||
}
|
||||
}
|
||||
|
||||
function create(int $groupfolderId, string $snapshotId, string $userId, $progressCallback): DiffTask {
|
||||
function create(int $groupfolderId, string $snapshotId, string $userId, Callable $progressCallback = null): DiffTask {
|
||||
$snapshotPath = $this->pathManager->getGroupFolderSnapshotDirectory($groupfolderId, $snapshotId);
|
||||
$groupfolderPath = $this->pathManager->getGroupFolderDirectory($groupfolderId);
|
||||
|
||||
|
@ -83,7 +83,7 @@ class DiffTaskService {
|
|||
$newResult = $this->diffTaskResultMapper->insert($newResult);
|
||||
},
|
||||
function($numDoneFiles) use ($progressCallback, &$numFiles) {
|
||||
if(($numFiles != 0) && ($numFiles != $numDoneFiles)) {
|
||||
if(isset($progressCallback) && ($numFiles != 0) && ($numFiles != $numDoneFiles)) {
|
||||
($progressCallback)([
|
||||
"overallFiles" => $numFiles,
|
||||
"doneFiles" => $numDoneFiles,
|
||||
|
@ -98,14 +98,15 @@ class DiffTaskService {
|
|||
|
||||
$diffTask->diff();
|
||||
|
||||
($progressCallback)([
|
||||
"overallFiles" => $numFiles,
|
||||
"doneFiles" => $numFiles,
|
||||
"progress" => 1.0,
|
||||
"progressPercent" => "100.00%",
|
||||
// TODO: include task results in object
|
||||
"result" => $task,
|
||||
]);
|
||||
if(isset($progressCallback)) {
|
||||
($progressCallback)([
|
||||
"overallFiles" => $numFiles,
|
||||
"doneFiles" => $numFiles,
|
||||
"progress" => 1.0,
|
||||
"progressPercent" => "100.00%",
|
||||
"result" => $task,
|
||||
]);
|
||||
}
|
||||
|
||||
return $task;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue