diff options
author | Andreas Fischer <bantu@owncloud.com> | 2013-09-23 16:22:48 +0200 |
---|---|---|
committer | Morris Jobke <morris.jobke@gmail.com> | 2013-11-03 12:33:31 +0100 |
commit | 329299e34cf14c57ce04fe4e2abb28fc26c0b3da (patch) | |
tree | d837af6fbb83cc39c91d0530cfa07e0af6e36c5f /lib/public | |
parent | 8872b881ccc9641607dbb12e308b55b3c1714698 (diff) | |
download | nextcloud-server-329299e34cf14c57ce04fe4e2abb28fc26c0b3da.tar.gz nextcloud-server-329299e34cf14c57ce04fe4e2abb28fc26c0b3da.zip |
OCP\Share::unshareAll(): Deduplicate hook parameters.
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/share.php | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/lib/public/share.php b/lib/public/share.php index e4f68017d26..a8d1436e100 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -665,19 +665,16 @@ class Share { public static function unshareAll($itemType, $itemSource) { if ($shares = self::getItemShared($itemType, $itemSource)) { // Pass all the vars we have for now, they may be useful - \OC_Hook::emit('OCP\Share', 'pre_unshareAll', array( + $hookParams = array( 'itemType' => $itemType, 'itemSource' => $itemSource, - 'shares' => $shares - )); + 'shares' => $shares, + ); + \OC_Hook::emit('OCP\Share', 'pre_unshareAll', $hookParams); foreach ($shares as $share) { self::delete($share['id']); } - \OC_Hook::emit('OCP\Share', 'post_unshareAll', array( - 'itemType' => $itemType, - 'itemSource' => $itemSource, - 'shares' => $shares - )); + \OC_Hook::emit('OCP\Share', 'post_unshareAll', $hookParams); return true; } return false; @@ -853,6 +850,27 @@ class Share { } /** + * Unshares a share given a share data array + * @param array $item Share data (usually database row) + * @return null + */ + protected static function unshareItem(array $item) { + // Pass all the vars we have for now, they may be useful + $hookParams = array( + 'itemType' => $item['item_type'], + 'itemSource' => $item['item_source'], + 'shareType' => $item['share_type'], + 'shareWith' => $item['share_with'], + 'itemParent' => $item['parent'], + ); + \OC_Hook::emit('OCP\Share', 'pre_unshare', $hookParams + array( + 'fileSource' => $item['file_source'], + )); + self::delete($item['id']); + \OC_Hook::emit('OCP\Share', 'post_unshare', $hookParams); + } + + /** * Get the backend class for the specified item type * @param string $itemType * @return Share_Backend |