summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/lib
diff options
context:
space:
mode:
authorSteven Bühner <buehner@me.com>2016-09-05 14:36:44 +0200
committerLukas Reschke <lukas@statuscode.ch>2016-09-20 12:07:03 +0200
commit1bd4eebb267c193beef8d96f5145b61ae0388e12 (patch)
tree1e92876b3da70ccc4a5290c0fc13fc44deaa38df /apps/files_trashbin/lib
parent2b37dc9c9e2c60461057e72a295eef7fdda6e8b4 (diff)
downloadnextcloud-server-1bd4eebb267c193beef8d96f5145b61ae0388e12.tar.gz
nextcloud-server-1bd4eebb267c193beef8d96f5145b61ae0388e12.zip
Also fire a bulk pre- and post-delete hook
Diffstat (limited to 'apps/files_trashbin/lib')
-rw-r--r--apps/files_trashbin/lib/Trashbin.php17
1 files changed, 14 insertions, 3 deletions
diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php
index 7c3797f420c..bf2fa57453f 100644
--- a/apps/files_trashbin/lib/Trashbin.php
+++ b/apps/files_trashbin/lib/Trashbin.php
@@ -474,17 +474,28 @@ class Trashbin {
// Array to store the relative path in (after the file is deleted, the view won't be able to relativise the path anymore)
$filePaths = array();
+ foreach($fileInfos as $fileInfo){
+ $filePaths[] = $view->getRelativePath($fileInfo->getPath());
+ }
+ unset($fileInfos); // save memory
+
+ // Bulk PreDelete-Hook
+ \OC_Hook::emit('\OCP\Trashbin', 'preDeleteAll', array('paths' => $filePaths));
- foreach($fileInfos as $key => $fileInfo){
- $filePaths[] = $path = $view->getRelativePath($fileInfo->getPath());
- unset($fileInfo[$key]); // save memory
+ // Single-File Hooks
+ foreach($filePaths as $path){
self::emitTrashbinPreDelete($path);
}
+ // actual file deletion
$view->deleteAll('files_trashbin');
$query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trash` WHERE `user`=?');
$query->execute(array($user));
+ // Bulk PostDelete-Hook
+ \OC_Hook::emit('\OCP\Trashbin', 'deleteAll', array('paths' => $filePaths));
+
+ // Single-File Hooks
foreach($filePaths as $path){
self::emitTrashbinPostDelete($path);
}