bring back updateFileTarget() got lost during last rebase
This commit is contained in:
parent
329bfd81c3
commit
884b9a0ecf
1 changed files with 31 additions and 0 deletions
|
@ -442,6 +442,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
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue