avoid unnecessary recursion
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
parent
fb40afc4d4
commit
3628d4d65d
|
@ -1853,20 +1853,19 @@ class Access extends LDAPUtility implements IUserTools {
|
||||||
|
|
||||||
$cookie = $this->getPagedResultCookie($base, $filter, $limit, $offset);
|
$cookie = $this->getPagedResultCookie($base, $filter, $limit, $offset);
|
||||||
if(empty($cookie) && $cookie !== "0" && ($offset > 0)) {
|
if(empty($cookie) && $cookie !== "0" && ($offset > 0)) {
|
||||||
// no cookie known, although the offset is not 0. Maybe cache run out. We need
|
// no cookie known from a potential previous search. We need
|
||||||
// to start all over *sigh* (btw, Dear Reader, did you know LDAP paged
|
// to start from 0 to come to the desired page. cookie value
|
||||||
// searching was designed by MSFT?)
|
// of '0' is valid, because 389ds
|
||||||
// Lukas: No, but thanks to reading that source I finally know!
|
$reOffset = 0;
|
||||||
// '0' is valid, because 389ds
|
while($reOffset < $offset) {
|
||||||
$reOffset = ($offset - $limit) < 0 ? 0 : $offset - $limit;
|
$this->search($filter, array($base), $attr, $limit, $reOffset, true);
|
||||||
//a bit recursive, $offset of 0 is the exit
|
$reOffset += $limit;
|
||||||
\OCP\Util::writeLog('user_ldap', 'Looking for cookie L/O '.$limit.'/'.$reOffset, \OCP\Util::INFO);
|
}
|
||||||
$this->search($filter, array($base), $attr, $limit, $reOffset, true);
|
|
||||||
$cookie = $this->getPagedResultCookie($base, $filter, $limit, $offset);
|
$cookie = $this->getPagedResultCookie($base, $filter, $limit, $offset);
|
||||||
//still no cookie? obviously, the server does not like us. Let's skip paging efforts.
|
//still no cookie? obviously, the server does not like us. Let's skip paging efforts.
|
||||||
|
// '0' is valid, because 389ds
|
||||||
//TODO: remember this, probably does not change in the next request...
|
//TODO: remember this, probably does not change in the next request...
|
||||||
if(empty($cookie) && $cookie !== '0') {
|
if(empty($cookie) && $cookie !== '0') {
|
||||||
// '0' is valid, because 389ds
|
|
||||||
$cookie = null;
|
$cookie = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ class Connection extends LDAPUtility {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return bool|mixed|void
|
* @return bool|mixed
|
||||||
*/
|
*/
|
||||||
public function __get($name) {
|
public function __get($name) {
|
||||||
if(!$this->configured) {
|
if(!$this->configured) {
|
||||||
|
|
Loading…
Reference in New Issue