diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-05-27 20:48:41 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-06-06 09:56:00 +0200 |
commit | 5132ae5e69fa0d02c05f789fcda4609f291b638f (patch) | |
tree | fbddc15c130ddc790c057ac9f4edfb61db49ad2f /apps/files_sharing/lib/sharedstorage.php | |
parent | b0a74edbb2fe91a8f82bb7437ff1a9ca4c3a03ec (diff) | |
download | nextcloud-server-5132ae5e69fa0d02c05f789fcda4609f291b638f.tar.gz nextcloud-server-5132ae5e69fa0d02c05f789fcda4609f291b638f.zip |
fix mount point move up if the parent no longer exists
Diffstat (limited to 'apps/files_sharing/lib/sharedstorage.php')
-rw-r--r-- | apps/files_sharing/lib/sharedstorage.php | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index f8c241425d3..1456ad18888 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -401,7 +401,6 @@ class Shared extends \OC\Files\Storage\Common { || $shares ) { foreach ($shares as $share) { - self::verifyMountPoint($share); $mount = new SharedMount( '\OC\Files\Storage\Shared', $options['user_dir'] . '/' . $share['file_target'], @@ -416,64 +415,6 @@ class Shared extends \OC\Files\Storage\Common { } /** - * check if the parent folder exists otherwise move the mount point up - * - * @param array $share reference to the share we want to check - */ - private static function verifyMountPoint(&$share) { - $mountPoint = basename($share['file_target']); - $parent = dirname($share['file_target']); - - while (!\OC\Files\Filesystem::is_dir($parent)) { - $parent = dirname($parent); - } - - $newMountPoint = \OCA\Files_Sharing\Helper::generateUniqueTarget( - \OC\Files\Filesystem::normalizePath($parent . '/' . $mountPoint), - array(), - new \OC\Files\View('/' . \OCP\User::getUser() . '/files') - ); - - if($newMountPoint !== $share['file_target']) { - - self::updateFileTarget($newMountPoint, $share); - $share['file_target'] = $newMountPoint; - - } - } - - /** - * update fileTarget in the database if the mount point changed - * @param string $newPath - * @param array $share reference to the share which should be modified - * @return type - */ - private static function updateFileTarget($newPath, &$share) { - // if the user renames a mount point from a group share we need to create a new db entry - // for the unique name - if ($share['share_type'] === \OCP\Share::SHARE_TYPE_GROUP && $this->uniqueNameSet() === false) { - $query = \OC_DB::prepare('INSERT INTO `*PREFIX*share` (`item_type`, `item_source`, `item_target`,' - .' `share_type`, `share_with`, `uid_owner`, `permissions`, `stime`, `file_source`,' - .' `file_target`, `token`, `parent`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)'); - $arguments = array($share['item_type'], $share['item_source'], $share['item_target'], - 2, \OCP\User::getUser(), $share['uid_owner'], $share['permissions'], $share['stime'], $share['file_source'], - $newPath, $share['token'], $share['id']); - - $this->setUniqueName(); - } else { - // rename mount point - $query = \OC_DB::prepare( - 'Update `*PREFIX*share` - SET `file_target` = ? - WHERE `id` = ?' - ); - $arguments = array($newPath, $share['id']); - } - - return $query->execute($arguments); - } - - /** * return mount point of share, relative to data/user/files * * @return string |