diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-04-05 17:50:49 +0300 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-04-06 11:18:36 +0300 |
commit | 579c6b1e5ac629760f049da3e555dad3173523ed (patch) | |
tree | ea996fbe1db5e8c7343d5f13ed5e713469c8df5b | |
parent | 9c84aa5870204a871024ca18b4994ed40defdd9b (diff) |
Use querybuilder for share external mountpointquerybuilder-shareexternal
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
-rw-r--r-- | apps/files_sharing/lib/External/MountProvider.php | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/apps/files_sharing/lib/External/MountProvider.php b/apps/files_sharing/lib/External/MountProvider.php index 36015162530..5b315e81f69 100644 --- a/apps/files_sharing/lib/External/MountProvider.php +++ b/apps/files_sharing/lib/External/MountProvider.php @@ -28,6 +28,7 @@ use OCP\Federation\ICloudIdManager; use OCP\Files\Config\IMountProvider; use OCP\Files\Storage\IStorageFactory; use OCP\IDBConnection; +use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IUser; class MountProvider implements IMountProvider { @@ -72,18 +73,19 @@ class MountProvider implements IMountProvider { } public function getMountsForUser(IUser $user, IStorageFactory $loader) { - $query = $this->connection->prepare(' - SELECT `remote`, `share_token`, `password`, `mountpoint`, `owner` - FROM `*PREFIX*share_external` - WHERE `user` = ? AND `accepted` = ? - '); - $query->execute([$user->getUID(), 1]); + $qb = $this->connection->getQueryBuilder(); + $qb->select('remote', 'share_token', 'password', 'mountpoint', 'owner') + ->from('share_external') + ->where($qb->expr()->eq('user', $qb->createNamedParameter($user->getUID()))) + ->andWhere($qb->expr()->eq('accepted', $qb->createNamedParameter(1, IQueryBuilder::PARAM_INT))); + $result = $qb->executeQuery(); $mounts = []; - while ($row = $query->fetch()) { + while ($row = $result->fetch()) { $row['manager'] = $this; $row['token'] = $row['share_token']; $mounts[] = $this->getMount($user, $row, $loader); } + $result->closeCursor(); return $mounts; } } |