1
0

Hooks.php 927 B

123456789101112131415161718192021222324252627282930313233
  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. use OC\Files\View;
  10. class Hooks {
  11. public static function deleteUser($params) {
  12. $manager = \OC::$server->get(External\Manager::class);
  13. $manager->removeUserShares($params['uid']);
  14. }
  15. public static function unshareChildren($params) {
  16. $path = Filesystem::getView()->getAbsolutePath($params['path']);
  17. $view = new View('/');
  18. // find share mount points within $path and unmount them
  19. $mountManager = Filesystem::getMountManager();
  20. $mountedShares = $mountManager->findIn($path);
  21. foreach ($mountedShares as $mount) {
  22. if ($mount->getStorage()->instanceOfStorage(ISharedStorage::class)) {
  23. $mountPoint = $mount->getMountPoint();
  24. $view->unlink($mountPoint);
  25. }
  26. }
  27. }
  28. }