summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/lib/Trashbin.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_trashbin/lib/Trashbin.php')
-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);
}