summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-08-26 21:34:22 -0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-08-26 21:34:37 -0400
commit18517f6adb92752a70be5a80ebf92ddf1d03babc (patch)
treee7cf5444dab5113dd65498e0b5642fd9aacc5296 /lib/public
parentc33a2ca01db0bf10b4604c2997bb3c1a904a32ac (diff)
downloadnextcloud-server-18517f6adb92752a70be5a80ebf92ddf1d03babc.tar.gz
nextcloud-server-18517f6adb92752a70be5a80ebf92ddf1d03babc.zip
Fix share getItems() limit
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/share.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/public/share.php b/lib/public/share.php
index 070d69d05ae..9ee7ef0516b 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -516,6 +516,14 @@ class Share {
// If the limit is not 1, the filtering can be done later
$where .= ' ORDER BY `*PREFIX*share`.`id` DESC';
}
+ // The limit must be at least 3, because filtering needs to be done
+ if ($limit < 3) {
+ $queryLimit = 3;
+ } else {
+ $queryLimit = $limit;
+ }
+ } else {
+ $queryLimit = null;
}
// TODO Optimize selects
if ($format == self::FORMAT_STATUSES) {
@@ -544,8 +552,7 @@ class Share {
}
}
$root = strlen($root);
- // The limit must be at least 3, because filtering needs to be done
- $query = \OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*share` '.$where, ($limit < 3 ? 3 : $limit));
+ $query = \OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*share` '.$where, $queryLimit);
$result = $query->execute($queryArgs);
$items = array();
$targets = array();