|
|
|
|
@ -126,6 +126,22 @@ class FileEventsListener implements IEventListener {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function touch_hook(Node $node): void {
|
|
|
|
|
// Do not handle folders.
|
|
|
|
|
if ($node instanceof Folder) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($node instanceof NonExistingFile) {
|
|
|
|
|
$this->logger->error(
|
|
|
|
|
'Failed to create or update version for {path}, node does not exist',
|
|
|
|
|
[
|
|
|
|
|
'path' => $node->getPath(),
|
|
|
|
|
]
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$previousNode = $this->nodesTouched[$node->getId()] ?? null;
|
|
|
|
|
|
|
|
|
|
if ($previousNode === null) {
|
|
|
|
|
@ -153,7 +169,22 @@ class FileEventsListener implements IEventListener {
|
|
|
|
|
|
|
|
|
|
public function created(Node $node): void {
|
|
|
|
|
// Do not handle folders.
|
|
|
|
|
if ($node instanceof File && $this->versionManager instanceof INeedSyncVersionBackend) {
|
|
|
|
|
if (!($node instanceof File)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($node instanceof NonExistingFile) {
|
|
|
|
|
$this->logger->error(
|
|
|
|
|
'Failed to create version for {path}, node does not exist',
|
|
|
|
|
[
|
|
|
|
|
'path' => $node->getPath(),
|
|
|
|
|
]
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($this->versionManager instanceof INeedSyncVersionBackend) {
|
|
|
|
|
$this->versionManager->createVersionEntity($node);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -191,6 +222,17 @@ class FileEventsListener implements IEventListener {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($node instanceof NonExistingFile) {
|
|
|
|
|
$this->logger->error(
|
|
|
|
|
'Failed to create or update version for {path}, node does not exist',
|
|
|
|
|
[
|
|
|
|
|
'path' => $node->getPath(),
|
|
|
|
|
]
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$writeHookInfo = $this->writeHookInfo[$node->getId()] ?? null;
|
|
|
|
|
|
|
|
|
|
if ($writeHookInfo === null) {
|
|
|
|
|
|