aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/lib
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-04-07 17:53:58 +0200
committerGitHub <noreply@github.com>2022-04-07 17:53:58 +0200
commitd7e094836bc172b98cbc5b047b542486344093f4 (patch)
tree738e2ed926f060a5a7e8839bc22ffa6671bfd0cb /apps/files_sharing/lib
parent462a43ac2b4879a369d2c7d36925aafe18d1f796 (diff)
parent579c6b1e5ac629760f049da3e555dad3173523ed (diff)
downloadnextcloud-server-d7e094836bc172b98cbc5b047b542486344093f4.tar.gz
nextcloud-server-d7e094836bc172b98cbc5b047b542486344093f4.zip
Merge pull request #31845 from nextcloud/querybuilder-shareexternal
Use querybuilder for share external mountpoint
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r--apps/files_sharing/lib/External/MountProvider.php16
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;
}
}