From 84677e87173b3a2ce2050a94f0776986bab06291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Mon, 27 Nov 2023 16:36:25 +0100 Subject: [PATCH] Emit hook when restoring a file from trashbin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- lib/Trash/TrashBackend.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/Trash/TrashBackend.php b/lib/Trash/TrashBackend.php index e1238519d..ac8aa27f7 100644 --- a/lib/Trash/TrashBackend.php +++ b/lib/Trash/TrashBackend.php @@ -172,6 +172,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(), + ] + ); } /**