nextcloud/apps/files_sharing/lib/Hooks.php

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
938 B
PHP
Raw Normal View History

<?php
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
* SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OCA\Files_Sharing;
2015-03-18 10:26:04 -04:00
use OC\Files\Filesystem;
use OC\Files\View;
use OCP\Server;
2015-03-18 10:26:04 -04:00
class Hooks {
public static function deleteUser($params) {
$manager = Server::get(External\Manager::class);
$manager->removeUserShares($params['uid']);
}
2015-03-18 10:26:04 -04:00
public static function unshareChildren($params) {
$path = Filesystem::getView()->getAbsolutePath($params['path']);
$view = new View('/');
2015-03-18 10:26:04 -04:00
// find share mount points within $path and unmount them
$mountManager = Filesystem::getMountManager();
2015-03-18 10:26:04 -04:00
$mountedShares = $mountManager->findIn($path);
foreach ($mountedShares as $mount) {
if ($mount->getStorage()->instanceOfStorage(ISharedStorage::class)) {
2015-03-18 10:26:04 -04:00
$mountPoint = $mount->getMountPoint();
$view->unlink($mountPoint);
}
}
}
}