aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/hooks.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/lib/hooks.php')
-rw-r--r--apps/files_sharing/lib/hooks.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/hooks.php b/apps/files_sharing/lib/hooks.php
index dc7317c5c7d..c3588ecdfe5 100644
--- a/apps/files_sharing/lib/hooks.php
+++ b/apps/files_sharing/lib/hooks.php
@@ -22,6 +22,8 @@
namespace OCA\Files_Sharing;
+use OC\Files\Filesystem;
+
class Hooks {
public static function deleteUser($params) {
@@ -35,4 +37,18 @@ class Hooks {
$manager->removeUserShares($params['uid']);
}
+ public static function unshareChildren($params) {
+ $path = Filesystem::getView()->getAbsolutePath($params['path']);
+ $view = new \OC\Files\View('/');
+
+ // find share mount points within $path and unmount them
+ $mountManager = \OC\Files\Filesystem::getMountManager();
+ $mountedShares = $mountManager->findIn($path);
+ foreach ($mountedShares as $mount) {
+ if ($mount->getStorage()->instanceOfStorage('OCA\Files_Sharing\ISharedStorage')) {
+ $mountPoint = $mount->getMountPoint();
+ $view->unlink($mountPoint);
+ }
+ }
+ }
}