fix Paginator (#7157)

This commit is contained in:
Diogenes S. Jesus 2019-06-14 18:54:09 +02:00 committed by snipe
parent c6039cbc1d
commit 4c61d330e6
2 changed files with 30 additions and 36 deletions

View file

@ -218,16 +218,16 @@ class LdapSync extends Command
*
* @param int $page The page to get the result set
*/
private function processLdapUsers(int $page=0): void
private function processLdapUsers(): void
{
try {
$ldapUsers = $this->ldap->getLdapUsers($page);
$ldapUsers = $this->ldap->getLdapUsers();
} catch (Exception $e) {
$this->outputError($e);
exit($e->getMessage());
}
if (0 == $ldapUsers->count()) {
if (0 == count($ldapUsers)) {
$msg = 'ERROR: No users found!';
Log::error($msg);
if ($this->dryrun) {
@ -240,10 +240,6 @@ class LdapSync extends Command
foreach ($ldapUsers as $user) {
$this->updateCreateUser($user);
}
if ($ldapUsers->getCurrentPage() < $ldapUsers->getPages()) {
$this->processLdapUsers($ldapUsers->getCurrentPage() + 1);
}
}
/**

View file

@ -430,11 +430,9 @@ class LdapAd extends LdapAdConfiguration
*
* @since 5.0.0
*
* @param int $page The paged results to get
*
* @return \Adldap\Query\Paginator
*/
public function getLdapUsers(int $page=0): Paginator
public function getLdapUsers(): Paginator
{
$search = $this->ldap->search()->users()->in($this->getBaseDn());
@ -444,6 +442,6 @@ class LdapAd extends LdapAdConfiguration
}
return $search->select($this->getSelectedFields())
->paginate(self::PAGE_SIZE, $page);
->paginate(self::PAGE_SIZE);
}
}