diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-07-02 14:40:22 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-07-04 10:34:54 +0200 |
commit | 3b9fa8158183950634172799737489cefccd170c (patch) | |
tree | a0965d3509af464225c5e1393be9b9aea9cdb3e9 /apps/files_sharing/lib/proxy.php | |
parent | e4a3f8d3c44f3238071d03f793cd2c5395062b5e (diff) | |
download | nextcloud-server-3b9fa8158183950634172799737489cefccd170c.tar.gz nextcloud-server-3b9fa8158183950634172799737489cefccd170c.zip |
if a folder gets deleted we unshare all shared files/folders below
Diffstat (limited to 'apps/files_sharing/lib/proxy.php')
-rw-r--r-- | apps/files_sharing/lib/proxy.php | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/apps/files_sharing/lib/proxy.php b/apps/files_sharing/lib/proxy.php index f595328cc63..92303d298b1 100644 --- a/apps/files_sharing/lib/proxy.php +++ b/apps/files_sharing/lib/proxy.php @@ -21,47 +21,43 @@ */ namespace OCA\Files\Share; +use OCA\Files_Sharing\Helper; class Proxy extends \OC_FileProxy { /** - * check if the deleted folder contains share mount points and move them - * up to the parent + * check if the deleted folder contains share mount points and unshare them * * @param string $path */ public function preUnlink($path) { - $this->moveMountPointsUp($path); + $this->unshareChildren($path); } /** - * check if the deleted folder contains share mount points and move them - * up to the parent + * check if the deleted folder contains share mount points and unshare them * * @param string $path */ public function preRmdir($path) { - $this->moveMountPointsUp($path); + $this->unshareChildren($path); } /** - * move share mount points up to the parent + * unshare shared items below the deleted folder * * @param string $path */ - private function moveMountPointsUp($path) { + private function unshareChildren($path) { $view = new \OC\Files\View('/'); - // find share mount points within $path and move them up to the parent folder - // before we delete $path + // 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('\OC\Files\Storage\Shared')) { + if ($mount->getStorage()->instanceOfStorage('OCA\Files_Sharing\ISharedStorage')) { $mountPoint = $mount->getMountPoint(); - $mountPointName = $mount->getMountPointName(); - $target = \OCA\Files_Sharing\Helper::generateUniqueTarget(dirname($path) . '/' . $mountPointName, array(), $view); - $view->rename($mountPoint, $target); + $view->unlink($mountPoint); } } } |