Files
nextcloud-server-mirror/apps/files_sharing/lib/Hooks.php
Carl Schwan e722745d0b refactor(hooks): Remove all non-used user hooks
And replace the few remaining by converting the event to hooks instead
of the other way around.

Signed-off-by: Carl Schwan <carlschwan@kde.org>
2026-09-17 18:07:35 +02:00

30 lines
787 B
PHP

<?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;
use OC\Files\Filesystem;
use OC\Files\View;
class Hooks {
public static function unshareChildren(array $params): void {
$path = Filesystem::getView()->getAbsolutePath($params['path']);
$view = new View('/');
// find share mount points within $path and unmount them
$mountManager = Filesystem::getMountManager();
$mountedShares = $mountManager->findIn($path);
foreach ($mountedShares as $mount) {
if ($mount->getStorage()->instanceOfStorage(ISharedStorage::class)) {
$mountPoint = $mount->getMountPoint();
$view->unlink($mountPoint);
}
}
}
}