diff options
Diffstat (limited to 'apps/files_sharing/lib/external/manager.php')
-rw-r--r-- | apps/files_sharing/lib/external/manager.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/external/manager.php b/apps/files_sharing/lib/external/manager.php index 665e47c0fe9..57dc38a9954 100644 --- a/apps/files_sharing/lib/external/manager.php +++ b/apps/files_sharing/lib/external/manager.php @@ -261,6 +261,33 @@ class Manager { } /** + * remove all shares for user $uid if the user was deleted + * + * @param string $uid + * @return bool + */ + public function removeUserShares($uid) { + $getShare = $this->connection->prepare(' + SELECT `remote`, `share_token`, `remote_id` + FROM `*PREFIX*share_external` + WHERE `user` = ?'); + $result = $getShare->execute(array($uid)); + + if ($result) { + $shares = $getShare->fetchAll(); + foreach($shares as $share) { + $this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'decline'); + } + } + + $query = $this->connection->prepare(' + DELETE FROM `*PREFIX*share_external` + WHERE `user` = ? + '); + return (bool)$query->execute(array($uid)); + } + + /** * return a list of shares which are not yet accepted by the user * * @return array list of open server-to-server shares |