Skip to content

Commit

Permalink
Emit hook when restoring a file from trashbin
Browse files Browse the repository at this point in the history
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
  • Loading branch information
come-nc committed Dec 21, 2023
1 parent fe045c0 commit 1bad5d1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/Trash/TrashBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,14 @@ public function restoreItem(ITrashItem $item) {
$targetFolder->getStorage()->moveFromStorage($trashStorage, $node->getInternalPath(), $targetLocation);
$targetFolder->getStorage()->getUpdater()->renameFromStorage($trashStorage, $node->getInternalPath(), $targetLocation);
$this->trashManager->removeItem((int)$folderId, $item->getName(), $item->getDeletedTime());
\OCP\Util::emitHook(
'\OCA\Files_Trashbin\Trashbin',
'post_restore',
[
'filePath' => '/' . $item->getGroupFolderMountPoint() . '/' . $originalLocation,
'trashPath' => $item->getPath(),
]
);
}

/**
Expand Down

0 comments on commit 1bad5d1

Please sign in to comment.