LdapConnection: Respect a query's offset not only for ordered results
refs #2765
This commit is contained in:
parent
37f22518bb
commit
ce4ae47805
|
@ -823,8 +823,11 @@ class LdapConnection implements Selectable, Inspectable
|
||||||
&& ($entry = ldap_next_entry($ds, $entry))
|
&& ($entry = ldap_next_entry($ds, $entry))
|
||||||
);
|
);
|
||||||
|
|
||||||
if (! $serverSorting && $query->hasOrder()) {
|
if (! $serverSorting) {
|
||||||
|
if ($query->hasOrder()) {
|
||||||
uasort($entries, array($query, 'compare'));
|
uasort($entries, array($query, 'compare'));
|
||||||
|
}
|
||||||
|
|
||||||
if ($limit && $count > $limit) {
|
if ($limit && $count > $limit) {
|
||||||
$entries = array_splice($entries, $query->hasOffset() ? $query->getOffset() : 0, $limit);
|
$entries = array_splice($entries, $query->hasOffset() ? $query->getOffset() : 0, $limit);
|
||||||
}
|
}
|
||||||
|
@ -994,8 +997,11 @@ class LdapConnection implements Selectable, Inspectable
|
||||||
ldap_search($ds, $query->getBase() ?: $this->getDn(), (string) $query);
|
ldap_search($ds, $query->getBase() ?: $this->getDn(), (string) $query);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $serverSorting && $query->hasOrder()) {
|
if (! $serverSorting) {
|
||||||
|
if ($query->hasOrder()) {
|
||||||
uasort($entries, array($query, 'compare'));
|
uasort($entries, array($query, 'compare'));
|
||||||
|
}
|
||||||
|
|
||||||
if ($limit && $count > $limit) {
|
if ($limit && $count > $limit) {
|
||||||
$entries = array_splice($entries, $query->hasOffset() ? $query->getOffset() : 0, $limit);
|
$entries = array_splice($entries, $query->hasOffset() ? $query->getOffset() : 0, $limit);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue