Put inner loop into own method, let's see whether it makes scrutinizer happier
This commit is contained in:
parent
bdc418d1f9
commit
2e5adadad7
|
@ -794,15 +794,8 @@ class Access extends LDAPUtility {
|
||||||
}
|
}
|
||||||
list($sr, $pagedSearchOK) = $search;
|
list($sr, $pagedSearchOK) = $search;
|
||||||
|
|
||||||
foreach($sr as $key => $res) {
|
$count = $this->countEntriesInSearchResults($sr, $limit, $continue);
|
||||||
$count = $this->ldap->countEntries($cr, $res);
|
$counter += $count;
|
||||||
if($count !== false) {
|
|
||||||
$counter += $count;
|
|
||||||
}
|
|
||||||
if($count === $limit) {
|
|
||||||
$continue = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->processPagedSearchStatus($sr, $filter, $base, $count, $limit,
|
$this->processPagedSearchStatus($sr, $filter, $base, $count, $limit,
|
||||||
$offset, $pagedSearchOK, $skipHandling);
|
$offset, $pagedSearchOK, $skipHandling);
|
||||||
|
@ -812,6 +805,22 @@ class Access extends LDAPUtility {
|
||||||
return $counter;
|
return $counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function countEntriesInSearchResults($searchResults, $limit,
|
||||||
|
&$hasHitLimit) {
|
||||||
|
$cr = $this->connection->getConnectionResource();
|
||||||
|
$count = 0;
|
||||||
|
|
||||||
|
foreach($searchResults as $res) {
|
||||||
|
$count = intval($this->ldap->countEntries($cr, $res));
|
||||||
|
$counter += $count;
|
||||||
|
if($count === $limit) {
|
||||||
|
$hasHitLimit = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $counter;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief executes an LDAP search
|
* @brief executes an LDAP search
|
||||||
* @param $filter the LDAP filter for the search
|
* @param $filter the LDAP filter for the search
|
||||||
|
|
Loading…
Reference in New Issue