bring back updateFileTarget() got lost during last rebase

remotes/origin/ldap_group_count
Bjoern Schiessle 11 years ago committed by Robin Appelman
parent 329bfd81c3
commit 884b9a0ecf
  1. 31
      apps/files_sharing/lib/sharedstorage.php

@ -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…
Cancel
Save