Add unshare event

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2017-03-14 15:12:16 +01:00
parent 9915aa6d9c
commit 5c9baf4ae2
No known key found for this signature in database
GPG Key ID: F941078878347C0C
1 changed files with 5 additions and 0 deletions

View File

@ -803,6 +803,9 @@ class Manager implements IManager {
throw new \InvalidArgumentException('Share does not have a full id');
}
$event = new GenericEvent($share);
$this->eventDispatcher->dispatch('OCP\Share::preUnshare', $event);
$formatHookParams = function(\OCP\Share\IShare $share) {
// Prepare hook
$shareType = $share->getShareType();
@ -852,6 +855,8 @@ class Manager implements IManager {
$hookParams['deletedShares'] = $formattedDeletedShares;
// Emit post hook
$event->setArgument('deletedShares', $deletedShares);
$this->eventDispatcher->dispatch('OCP\Share::postUnshare', $event);
\OC_Hook::emit('OCP\Share', 'post_unshare', $hookParams);
}