aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib/updater.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/lib/updater.php')
-rw-r--r--apps/files_sharing/lib/updater.php17
1 files changed, 9 insertions, 8 deletions
diff --git a/apps/files_sharing/lib/updater.php b/apps/files_sharing/lib/updater.php
index 10da2462807..0e6433b1122 100644
--- a/apps/files_sharing/lib/updater.php
+++ b/apps/files_sharing/lib/updater.php
@@ -81,8 +81,10 @@ class Shared_Updater {
$src = $userFolder->get($path);
- $type = $src instanceof \OCP\Files\File ? 'file' : 'folder';
- $shares = \OCP\Share::getItemShared($type, $src->getId());
+ $shareManager = \OC::$server->getShareManager();
+
+ $shares = $shareManager->getSharesBy($userFolder->getOwner()->getUID(), \OCP\Share::SHARE_TYPE_USER, $src, false, -1);
+ $shares = array_merge($shares, $shareManager->getSharesBy($userFolder->getOwner()->getUID(), \OCP\Share::SHARE_TYPE_GROUP, $src, false, -1));
// If the path we move is not a share we don't care
if (empty($shares)) {
@@ -96,14 +98,13 @@ class Shared_Updater {
return;
}
- $parenShare = $dstMount->getShare();
+ $newOwner = $dstMount->getShare()->getShareOwner();
+ //Ownership is moved over
foreach ($shares as $share) {
- $qb = \OC::$server->getDatabaseConnection()->getQueryBuilder();
- $qb->update('share')
- ->set('parent', $qb->createNamedParameter($parenShare['id']))
- ->where($qb->expr()->eq('id', $qb->createNamedParameter($share['id'])))
- ->execute();
+ /** @var \OCP\Share\IShare $share */
+ $share->setShareOwner($newOwner);
+ $shareManager->updateShare($share);
}
}