diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-03-26 13:07:12 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-03-26 14:40:23 +0200 |
commit | f4fd0224db82b1bab3e7f661686718fa9aebdf3b (patch) | |
tree | cf48b9c0f9877e5d6842838df17463a0e11c87c2 /apps/federatedfilesharing/lib/Controller | |
parent | e2b44d199bea7da74811689ec3ab787135e22de6 (diff) | |
download | nextcloud-server-f4fd0224db82b1bab3e7f661686718fa9aebdf3b.tar.gz nextcloud-server-f4fd0224db82b1bab3e7f661686718fa9aebdf3b.zip |
Do not use \OCP\DB anymore
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/federatedfilesharing/lib/Controller')
-rw-r--r-- | apps/federatedfilesharing/lib/Controller/RequestHandlerController.php | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php index bc81db50b28..90346546a23 100644 --- a/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php +++ b/apps/federatedfilesharing/lib/Controller/RequestHandlerController.php @@ -427,9 +427,19 @@ class RequestHandlerController extends OCSController { $token = isset($_POST['token']) ? $_POST['token'] : null; - $query = \OCP\DB::prepare('SELECT * FROM `*PREFIX*share_external` WHERE `remote_id` = ? AND `share_token` = ?'); - $query->execute(array($id, $token)); - $share = $query->fetchRow(); + $qb = $this->connection->getQueryBuilder(); + $qb->select('*') + ->from('share_external') + ->where( + $qb->expr()->andX( + $qb->expr()->eq('remote_id', $qb->createNamedParameter($id)), + $qb->expr()->eq('share_token', $qb->createNamedParameter($token)) + ) + ); + + $result = $qb->execute(); + $share = $result->fetch(); + $result->closeCursor(); if ($token && $id && !empty($share)) { @@ -439,8 +449,17 @@ class RequestHandlerController extends OCSController { $mountpoint = $share['mountpoint']; $user = $share['user']; - $query = \OCP\DB::prepare('DELETE FROM `*PREFIX*share_external` WHERE `remote_id` = ? AND `share_token` = ?'); - $query->execute(array($id, $token)); + $qb = $this->connection->getQueryBuilder(); + $qb->delete('share_external') + ->where( + $qb->expr()->andX( + $qb->expr()->eq('remote_id', $qb->createNamedParameter($id)), + $qb->expr()->eq('share_token', $qb->createNamedParameter($token)) + ) + ); + + $result = $qb->execute(); + $result->closeCursor(); if ($share['accepted']) { $path = trim($mountpoint, '/'); |