moved diff functionality into own service

This commit is contained in:
Jonathan Treffler 2023-09-02 02:48:27 +02:00 committed by root
parent c9d52b4c77
commit a0b6a25508
4 changed files with 359 additions and 219 deletions

View file

@ -3,18 +3,15 @@
namespace OCA\GroupfolderFilesystemSnapshots\Manager;
use OCA\GroupfolderFilesystemSnapshots\Manager\PathManager;
use OCA\GroupfolderFilesystemSnapshots\Manager\DiffManager;
use OCA\GroupfolderFilesystemSnapshots\Entity\Snapshot;
class SnapshotManager {
private PathManager $pathManager;
private DiffManager $diffManager;
public function __construct(PathManager $pathManager, DiffManager $diffManager){
public function __construct(PathManager $pathManager){
$this->pathManager = $pathManager;
$this->diffManager = $diffManager;
}
private function validSnapshotId(string $snapshotId) {
@ -46,11 +43,4 @@ class SnapshotManager {
yield new Snapshot($fileinfo->getFilename());
}
}
function getDiff(int $groupfolderId, string $snapshotId) {
$groupfolderPath = $this->pathManager->getGroupFolderDirectory($groupfolderId);
$snapshotPath = $this->pathManager->getGroupFolderSnapshotDirectory($groupfolderId, $snapshotId);
return $this->diffManager->diffDirectories($snapshotPath, $groupfolderPath);
}
}