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);
|
$snapshotPath = $this->pathManager->getGroupFolderSnapshotDirectory($groupfolderId, $snapshotId);
|
||||||
$groupfolderPath = $this->pathManager->getGroupFolderDirectory($groupfolderId);
|
$groupfolderPath = $this->pathManager->getGroupFolderDirectory($groupfolderId);
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ class DiffTaskService {
|
||||||
$newResult = $this->diffTaskResultMapper->insert($newResult);
|
$newResult = $this->diffTaskResultMapper->insert($newResult);
|
||||||
},
|
},
|
||||||
function($numDoneFiles) use ($progressCallback, &$numFiles) {
|
function($numDoneFiles) use ($progressCallback, &$numFiles) {
|
||||||
if(($numFiles != 0) && ($numFiles != $numDoneFiles)) {
|
if(isset($progressCallback) && ($numFiles != 0) && ($numFiles != $numDoneFiles)) {
|
||||||
($progressCallback)([
|
($progressCallback)([
|
||||||
"overallFiles" => $numFiles,
|
"overallFiles" => $numFiles,
|
||||||
"doneFiles" => $numDoneFiles,
|
"doneFiles" => $numDoneFiles,
|
||||||
|
@ -98,14 +98,15 @@ class DiffTaskService {
|
||||||
|
|
||||||
$diffTask->diff();
|
$diffTask->diff();
|
||||||
|
|
||||||
($progressCallback)([
|
if(isset($progressCallback)) {
|
||||||
"overallFiles" => $numFiles,
|
($progressCallback)([
|
||||||
"doneFiles" => $numFiles,
|
"overallFiles" => $numFiles,
|
||||||
"progress" => 1.0,
|
"doneFiles" => $numFiles,
|
||||||
"progressPercent" => "100.00%",
|
"progress" => 1.0,
|
||||||
// TODO: include task results in object
|
"progressPercent" => "100.00%",
|
||||||
"result" => $task,
|
"result" => $task,
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
return $task;
|
return $task;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue