Added current fileId to DiffTaskResult; implemented folder blocklist feature; fixed indentations of some files; bumped version
This commit is contained in:
parent
85d63d5ae2
commit
acf8990de1
6 changed files with 253 additions and 212 deletions
|
@ -58,7 +58,8 @@ class DiffTaskService {
|
|||
}
|
||||
}
|
||||
|
||||
function create(string $relativePathInGroupfolder, int $groupfolderId, string $snapshotId, string $userId, Callable $progressCallback = null): ?DiffTask {
|
||||
function create(string $relativePathInGroupfolder, int $groupfolderId, string $snapshotId, string $userId, array $folderBlocklist, Callable $progressCallback = null): ?DiffTask {
|
||||
$parentNode = $this->pathManager->getGroupfolderMountById($groupfolderId)->get($relativePathInGroupfolder);
|
||||
$snapshotPath = $this->pathManager->getGroupFolderSnapshotDirectory($groupfolderId, $relativePathInGroupfolder, $snapshotId);
|
||||
$groupfolderPath = $this->pathManager->getGroupFolderDirectory($groupfolderId, $relativePathInGroupfolder);
|
||||
|
||||
|
@ -80,16 +81,25 @@ class DiffTaskService {
|
|||
$snapshotPath,
|
||||
$groupfolderPath,
|
||||
"",
|
||||
function(string $type, bool $beforeFileExists, ?string $beforePath, ?int $beforeSize, bool $currentFileExists, ?string $currentPath, ?int $currentSize) use ($task) {
|
||||
$folderBlocklist,
|
||||
function(string $type, bool $beforeFileExists, ?string $beforePath, ?int $beforeSize, bool $currentFileExists, ?string $currentPath, ?int $currentSize) use ($task, $parentNode) {
|
||||
$newResult = new DiffTaskResult();
|
||||
$newResult->setTaskId($task->getId());
|
||||
$newResult->setType($type);
|
||||
|
||||
$newResult->setBeforeFileExists($beforeFileExists);
|
||||
$newResult->setBeforePath($beforePath);
|
||||
$newResult->setBeforeSize($beforeSize);
|
||||
if($beforeFileExists) {
|
||||
$newResult->setBeforePath($beforePath);
|
||||
$newResult->setBeforeSize($beforeSize);
|
||||
}
|
||||
|
||||
$newResult->setCurrentFileExists($currentFileExists);
|
||||
$newResult->setCurrentPath($currentPath);
|
||||
$newResult->setCurrentSize($currentSize);
|
||||
if($currentFileExists) {
|
||||
$newResult->setCurrentFileId($parentNode->get($currentPath)?->getId());
|
||||
$newResult->setCurrentPath($currentPath);
|
||||
$newResult->setCurrentSize($currentSize);
|
||||
}
|
||||
|
||||
$newResult = $this->diffTaskResultMapper->insert($newResult);
|
||||
},
|
||||
function($numDoneFiles) use ($progressCallback, &$numFiles) {
|
||||
|
@ -97,8 +107,7 @@ class DiffTaskService {
|
|||
($progressCallback)([
|
||||
"overallFiles" => $numFiles,
|
||||
"doneFiles" => $numDoneFiles,
|
||||
"progress" => number_format(($numDoneFiles / $numFiles),2),
|
||||
"progressPercent" => (number_format(($numDoneFiles / $numFiles),2) * 100) . "%",
|
||||
"progress" => round(($numDoneFiles / $numFiles),2),
|
||||
]);
|
||||
}
|
||||
},
|
||||
|
@ -113,7 +122,6 @@ class DiffTaskService {
|
|||
"overallFiles" => $numFiles,
|
||||
"doneFiles" => $numFiles,
|
||||
"progress" => 1.0,
|
||||
"progressPercent" => "100.00%",
|
||||
"result" => $task,
|
||||
]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue