From 1bad5d170a2bb326c58e54c6f508b3e4b67c2a07 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 78abfe241..6c98c73e3 100644 --- a/lib/Trash/TrashBackend.php +++ b/lib/Trash/TrashBackend.php @@ -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(), + ] + ); } /**