diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-05-27 16:28:32 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-06-06 09:56:00 +0200 |
commit | 884b9a0ecf5c8bfba4e8b988ee39c705dcc892cd (patch) | |
tree | 1add70bbab66dcdd2b0953f02da56a1b708f26f1 /apps | |
parent | 329bfd81c33ed95fdc91658cd914611605cd114f (diff) | |
download | nextcloud-server-884b9a0ecf5c8bfba4e8b988ee39c705dcc892cd.tar.gz nextcloud-server-884b9a0ecf5c8bfba4e8b988ee39c705dcc892cd.zip |
bring back updateFileTarget() got lost during last rebase
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/lib/sharedstorage.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index c5b5060893a..f8c241425d3 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -443,6 +443,37 @@ class Shared extends \OC\Files\Storage\Common { } /** + * 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 |