implemented snapshot name parsing
This commit is contained in:
parent
a024d93e02
commit
85d63d5ae2
8 changed files with 175 additions and 36 deletions
|
@ -58,7 +58,7 @@ class DiffTaskResultService {
|
|||
$diffTaskResult = $this->find($id);
|
||||
|
||||
if($diffTaskResult->getReverted()) {
|
||||
throw new AlreadyRevertedException;
|
||||
throw new AlreadyRevertedException();
|
||||
}
|
||||
|
||||
$taskId = $diffTaskResult->getTaskId();
|
||||
|
@ -66,35 +66,35 @@ class DiffTaskResultService {
|
|||
|
||||
$snapshotPath = $this->pathManager->getGroupFolderSnapshotDirectory($diffTask->getGroupfolderId(), $diffTask->getRelativePath(), $diffTask->getSnapshotId());
|
||||
|
||||
$gruenerFolder = $this->pathManager->getGroupfolderMountById($diffTask->getGroupfolderId())->get($diffTask->getRelativePath());
|
||||
$parentFolder = $this->pathManager->getGroupfolderMountById($diffTask->getGroupfolderId())->get($diffTask->getRelativePath());
|
||||
|
||||
switch($diffTaskResult->getType()) {
|
||||
case "CREATION":
|
||||
$currentFile = $this->getSubfolderMustExist($gruenerFolder, $diffTaskResult->getCurrentPath());
|
||||
$currentFile = $this->getSubfolderMustExist($parentFolder, $diffTaskResult->getCurrentPath());
|
||||
$currentFile->delete();
|
||||
break;
|
||||
case "RENAME":
|
||||
$currentFile = $this->getSubfolderMustExist($gruenerFolder, $diffTaskResult->getCurrentPath());
|
||||
$beforeDirectory = $this->getOrCreateSubdirectoryByFilepath($gruenerFolder, $diffTaskResult->getBeforePath());
|
||||
$currentFile = $this->getSubfolderMustExist($parentFolder, $diffTaskResult->getCurrentPath());
|
||||
$beforeDirectory = $this->getOrCreateSubdirectoryByFilepath($parentFolder, $diffTaskResult->getBeforePath());
|
||||
|
||||
$currentFile->move($beforeDirectory->getPath() . DIRECTORY_SEPARATOR . basename($diffTaskResult->getBeforePath()));
|
||||
break;
|
||||
case "DELETION":
|
||||
$beforeFileFilesystemPath = $snapshotPath . DIRECTORY_SEPARATOR . $diffTaskResult->getBeforePath();
|
||||
|
||||
$beforeDirectory = $this->getOrCreateSubdirectoryByFilepath($gruenerFolder, $diffTaskResult->getBeforePath());
|
||||
$beforeDirectory = $this->getOrCreateSubdirectoryByFilepath($parentFolder, $diffTaskResult->getBeforePath());
|
||||
$restoredFile = $beforeDirectory->newFile(basename($diffTaskResult->getBeforePath()));
|
||||
|
||||
$this->copyFilesystemFileToNextcloudFile($beforeFileFilesystemPath, $restoredFile);
|
||||
break;
|
||||
case "EDIT":
|
||||
$currentFile = $this->getSubfolderMustExist($gruenerFolder, $diffTaskResult->getCurrentPath());
|
||||
$currentFile = $this->getSubfolderMustExist($parentFolder, $diffTaskResult->getCurrentPath());
|
||||
$beforeFileFilesystemPath = $snapshotPath . DIRECTORY_SEPARATOR . $diffTaskResult->getBeforePath();
|
||||
|
||||
$this->copyFilesystemFileToNextcloudFile($beforeFileFilesystemPath, $currentFile);
|
||||
break;
|
||||
default:
|
||||
throw new \Exception;
|
||||
throw new Exception();
|
||||
}
|
||||
|
||||
return $this->mapper->markReverted($id);
|
||||
|
@ -104,7 +104,7 @@ class DiffTaskResultService {
|
|||
if($parent->nodeExists($path)) {
|
||||
return $parent->get($path);
|
||||
} else {
|
||||
throw new ChangesMadeSinceDiffException;
|
||||
throw new ChangesMadeSinceDiffException();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ class DiffTaskResultService {
|
|||
if($temp instanceof \OCP\Files\Folder) {
|
||||
$beforeDirectory = $temp;
|
||||
} else {
|
||||
throw new ChangesMadeSinceDiffException;
|
||||
throw new ChangesMadeSinceDiffException();
|
||||
}
|
||||
} else {
|
||||
$beforeDirectory = $beforeDirectory->newFolder($subdir);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue