Hooks.php 928 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCA\Files_Sharing;
  8. use OC\Files\Filesystem;
  9. class Hooks {
  10. public static function deleteUser($params) {
  11. $manager = \OC::$server->get(External\Manager::class);
  12. $manager->removeUserShares($params['uid']);
  13. }
  14. public static function unshareChildren($params) {
  15. $path = Filesystem::getView()->getAbsolutePath($params['path']);
  16. $view = new \OC\Files\View('/');
  17. // find share mount points within $path and unmount them
  18. $mountManager = \OC\Files\Filesystem::getMountManager();
  19. $mountedShares = $mountManager->findIn($path);
  20. foreach ($mountedShares as $mount) {
  21. if ($mount->getStorage()->instanceOfStorage(ISharedStorage::class)) {
  22. $mountPoint = $mount->getMountPoint();
  23. $view->unlink($mountPoint);
  24. }
  25. }
  26. }
  27. }