mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Merge pull request #8594 from uberbrady/try_to_fix_ldap_oom
Possible fix to #8563 - unset $ldapUsers to avoid OOM'ing
This commit is contained in:
commit
d517e2fd61
|
@ -117,7 +117,7 @@ class LdapSync extends Command
|
||||||
$this->dryrun = true;
|
$this->dryrun = true;
|
||||||
}
|
}
|
||||||
$this->checkIfLdapIsEnabled();
|
$this->checkIfLdapIsEnabled();
|
||||||
$this->checkLdapConnetion();
|
$this->checkLdapConnection();
|
||||||
$this->setBaseDn();
|
$this->setBaseDn();
|
||||||
$this->getUserDefaultLocation();
|
$this->getUserDefaultLocation();
|
||||||
/*
|
/*
|
||||||
|
@ -247,7 +247,9 @@ class LdapSync extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ldapUsers->getCurrentPage() < $ldapUsers->getPages()-1) {
|
if ($ldapUsers->getCurrentPage() < $ldapUsers->getPages()-1) {
|
||||||
$this->processLdapUsers($ldapUsers->getCurrentPage() + 1);
|
$current_page = $ldapUsers->getCurrentPage();
|
||||||
|
unset($ldapUsers); //deliberately unset the variable so we don't OOM
|
||||||
|
$this->processLdapUsers($current_page + 1); //this recursive call means that the $ldapUsers variable is not going to get GC'ed until everything returns. Blech.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,7 +357,7 @@ class LdapSync extends Command
|
||||||
*
|
*
|
||||||
* @since 5.0.0
|
* @since 5.0.0
|
||||||
*/
|
*/
|
||||||
private function checkLdapConnetion(): void
|
private function checkLdapConnection(): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$this->ldap->testLdapAdUserConnection();
|
$this->ldap->testLdapAdUserConnection();
|
||||||
|
|
Loading…
Reference in a new issue