Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Listener/FileListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function handle(Event $event): void {
if ($event instanceof \OCP\Files\Config\Event\UserMountAddedEvent) {
$rootId = $event->mountPoint->getRootId();
// Asynchronous, because we potentially recurse and this event needs to be handled fast
$this->fsEventScheduler->onAccessUpdateDecl($rootId);
$this->fsEventScheduler->onAccessUpdateDecl($rootId, $event->mountPoint->getUser()->getUID());
// Remember that this mount was added in the current process (see UserMountRemovedEvent below)
$this->addedMounts[$event->mountPoint->getUser()->getUID() . '-' . $rootId] = true;
}
Expand All @@ -130,7 +130,7 @@ public function handle(Event $event): void {
return;
}
// Asynchronous, because we potentially recurse and this event needs to be handled fast
$this->fsEventScheduler->onAccessUpdateDecl($rootId);
$this->fsEventScheduler->onAccessUpdateDecl($rootId, $event->mountPoint->getUser()->getUID());
}
} catch (InvalidPathException|Exception|NotFoundException $e) {
$this->logger->warning('Error in fs event listener: ' . $e->getMessage(), ['exception' => $e]);
Expand Down
10 changes: 6 additions & 4 deletions lib/Service/FsEventScheduler.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ private function retractEvent(FsEventType $type, string $ownerId, int $nodeId) {
* @throws NotFoundException
* @throws Exception
*/
public function onAccessUpdateDecl(int $nodeId): void {
$ownerId = $this->storageService->getOwnerForFileId($nodeId);
if ($ownerId === false) {
throw new NotFoundException('Cannot get owner for file ID ' . $nodeId);
public function onAccessUpdateDecl(int $nodeId, $ownerId = null): void {
if ($ownerId === null) {
$ownerId = $this->storageService->getOwnerForFileId($nodeId);
if ($ownerId === false) {
throw new NotFoundException('Cannot get owner for file ID ' . $nodeId);
}
}
$this->scheduleEvent(FsEventType::ACCESS_UPDATE_DECL, $ownerId, $nodeId);
}
Expand Down
Loading