Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions apps/federatedfilesharing/lib/FederatedShareProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,7 @@ public function getChildren(IShare $parent): array {
$qb->select('*')
->from('share')
->where($qb->expr()->eq('parent', $qb->createNamedParameter($parent->getId())))
->andWhere($qb->expr()->in('share_type', $qb->createNamedParameter($this->supportedShareType, IQueryBuilder::PARAM_INT_ARRAY)))
->orderBy('id');
->andWhere($qb->expr()->in('share_type', $qb->createNamedParameter($this->supportedShareType, IQueryBuilder::PARAM_INT_ARRAY)));

$cursor = $qb->executeQuery();
while ($data = $cursor->fetchAssociative()) {
Expand Down Expand Up @@ -547,8 +546,6 @@ private function getSharesInFolderInternal(?string $userId, Folder $node, ?bool

$qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId())));

$qb->orderBy('id');

$cursor = $qb->executeQuery();
$shares = [];
while ($data = $cursor->fetchAssociative()) {
Expand Down Expand Up @@ -604,7 +601,9 @@ public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offs
}

$qb->setFirstResult($offset);
$qb->orderBy('id');
if ($offset !== 0 || $limit !== -1) {
$qb->orderBy('id');
}

$cursor = $qb->executeQuery();
$shares = [];
Expand Down Expand Up @@ -684,8 +683,9 @@ public function getSharedWith($userId, $shareType, $node, $limit, $offset) {
$qb->select('*')
->from('share');

// Order by id
$qb->orderBy('id');
if ($offset !== 0 || $limit !== -1) {
$qb->orderBy('id');
}

// Set limit and offset
if ($limit !== -1) {
Expand Down
15 changes: 8 additions & 7 deletions apps/sharebymail/lib/ShareByMailProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,7 @@ public function getChildren(IShare $parent): array {
$qb->select('*')
->from('share')
->where($qb->expr()->eq('parent', $qb->createNamedParameter($parent->getId())))
->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_EMAIL)))
->orderBy('id');
->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(IShare::TYPE_EMAIL)));

$cursor = $qb->executeQuery();
while ($data = $cursor->fetchAssociative()) {
Expand Down Expand Up @@ -854,7 +853,9 @@ public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offs
}

$qb->setFirstResult($offset);
$qb->orderBy('id');
if ($offset !== 0 || $limit !== -1) {
$qb->orderBy('id');
}

$cursor = $qb->executeQuery();
$shares = [];
Expand Down Expand Up @@ -935,8 +936,10 @@ public function getSharedWith($userId, $shareType, $node, $limit, $offset): arra
$qb->select('*')
->from('share');

// Order by id
$qb->orderBy('id');
// Order by id only if we need it for limit/offset
if ($offset !== 0 || $limit !== -1) {
$qb->orderBy('id');
}

// Set limit and offset
if ($limit !== -1) {
Expand Down Expand Up @@ -1176,8 +1179,6 @@ private function getSharesInFolderInternal(?string $userId, Folder $node, ?bool

$qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId())));

$qb->orderBy('id');

$cursor = $qb->executeQuery();
$shares = [];
while ($data = $cursor->fetchAssociative()) {
Expand Down
Loading