diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2018-06-29 17:47:36 +0200 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2018-07-11 10:11:46 +0200 |
commit | 7d2add622e1948f85e0c2abe4fc5a71123b7bcde (patch) | |
tree | 4d63f3a47717bb0b39cfee9bcb354153d16e87bf /apps/files_sharing/lib/External/Manager.php | |
parent | f5a816262c79d84c373d635fced8ca20cdd0d0ea (diff) | |
download | nextcloud-server-7d2add622e1948f85e0c2abe4fc5a71123b7bcde.tar.gz nextcloud-server-7d2add622e1948f85e0c2abe4fc5a71123b7bcde.zip |
unshare from self
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps/files_sharing/lib/External/Manager.php')
-rw-r--r-- | apps/files_sharing/lib/External/Manager.php | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/apps/files_sharing/lib/External/Manager.php b/apps/files_sharing/lib/External/Manager.php index 7b3e77771c3..9f8acbce4cb 100644 --- a/apps/files_sharing/lib/External/Manager.php +++ b/apps/files_sharing/lib/External/Manager.php @@ -515,28 +515,33 @@ class Manager { $hash = md5($mountPoint); $getShare = $this->connection->prepare(' - SELECT `remote`, `share_token`, `remote_id` + SELECT `remote`, `share_token`, `remote_id`, `share_type`, `id` FROM `*PREFIX*share_external` WHERE `mountpoint_hash` = ? AND `user` = ?'); $result = $getShare->execute(array($hash, $this->uid)); - if ($result) { + $share = $getShare->fetch(); + $getShare->closeCursor(); + if ($result && (int)$share['share_type'] === Share::SHARE_TYPE_USER) { try { - $share = $getShare->fetch(); $this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'decline'); } catch (\Exception $e) { // if we fail to notify the remote (probably cause the remote is down) // we still want the share to be gone to prevent undeletable remotes } - } - $getShare->closeCursor(); - $query = $this->connection->prepare(' + $query = $this->connection->prepare(' DELETE FROM `*PREFIX*share_external` - WHERE `mountpoint_hash` = ? - AND `user` = ? - '); - $result = (bool)$query->execute(array($hash, $this->uid)); + WHERE `id` = ? + '); + $result = (bool)$query->execute(array((int)$share['id'])); + } else if ($result && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) { + $query = $this->connection->prepare(' + UPDATE `*PREFIX*share_external` + SET `accepted` = ? + WHERE `id` = ?'); + $result = (bool)$query->execute(array(0, (int)$share['id'])); + } if($result) { $this->removeReShares($id); |