diff options
author | Steven Bühner <buehner@me.com> | 2016-08-30 09:04:01 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2016-09-20 12:06:51 +0200 |
commit | a41541ae22e6d9c946db32afdefdfeaf977c7263 (patch) | |
tree | 7a15b80acd8a30a5d53f91ecb43c8acb97e66bf7 /apps/files_trashbin | |
parent | 2f555cb10d1731c45d2d18db7a74f956d17baa67 (diff) | |
download | nextcloud-server-a41541ae22e6d9c946db32afdefdfeaf977c7263.tar.gz nextcloud-server-a41541ae22e6d9c946db32afdefdfeaf977c7263.zip |
Emit hooks for each file before and after all files in trashbin have been deleted.
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r-- | apps/files_trashbin/lib/Trashbin.php | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index 84e522043ae..657cf79f877 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -470,21 +470,21 @@ class Trashbin { public static function deleteAll() { $user = User::getUser(); $view = new View('/' . $user); - $fileInfos = $view->getDirectoryContent('files_trashbin/files'); + $fileInfos = $view->getDirectoryContent('files_trashbin/files'); - foreach($fileInfos as $fileInfo){ - $path = $view->getRelativePath($fileInfo->getPath()); - self::emitTrashbinPreDelete($path); - } + foreach($fileInfos as $fileInfo){ + $path = $view->getRelativePath($fileInfo->getPath()); + self::emitTrashbinPreDelete($path); + } $view->deleteAll('files_trashbin'); $query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trash` WHERE `user`=?'); $query->execute(array($user)); - foreach($fileInfos as $fileInfo){ - $path = $fileInfo->getPath(); - self::emitTrashbinPostDelete($path); - } + foreach($fileInfos as $fileInfo){ + $path = $fileInfo->getPath(); + self::emitTrashbinPostDelete($path); + } $view->mkdir('files_trashbin'); $view->mkdir('files_trashbin/files'); @@ -492,21 +492,21 @@ class Trashbin { return true; } - /** - * wrapper function to emit the 'preDelete' hook of \OCP\Trashbin before a file is deleted - * @param string $path - */ + /** + * wrapper function to emit the 'preDelete' hook of \OCP\Trashbin before a file is deleted + * @param string $path + */ protected static function emitTrashbinPreDelete($path){ - \OC_Hook::emit('\OCP\Trashbin', 'preDelete', array('path' => $path)); - } + \OC_Hook::emit('\OCP\Trashbin', 'preDelete', array('path' => $path)); + } - /** - * wrapper function to emit the 'delete' hook of \OCP\Trashbin after a file has been deleted - * @param string $path - */ - protected static function emitTrashbinPostDelete($path){ - \OC_Hook::emit('\OCP\Trashbin', 'delete', array('path' => $path)); - } + /** + * wrapper function to emit the 'delete' hook of \OCP\Trashbin after a file has been deleted + * @param string $path + */ + protected static function emitTrashbinPostDelete($path){ + \OC_Hook::emit('\OCP\Trashbin', 'delete', array('path' => $path)); + } /** * delete file from trash bin permanently @@ -536,7 +536,7 @@ class Trashbin { } else { $size += $view->filesize('/files_trashbin/files/' . $file); } - self::emitTrashbinPreDelete('/files_trashbin/files/' . $file); + self::emitTrashbinPreDelete('/files_trashbin/files/' . $file); $view->unlink('/files_trashbin/files/' . $file); self::emitTrashbinPostDelete('/files_trashbin/files/' . $file); |