Skip to content
Permalink
Browse files

Here's a little patch for auth/ldap/lib.php... just stops some

errors from popping up.
Credit: Alastair Pharo <alastair@catalyst.net.nz>
  • Loading branch information...
mjollnir_
mjollnir_ committed Sep 26, 2006
1 parent 75673b9 commit 7d49253f40c19af1cb34ff65657ed1fc3c48d6ca
Showing with 18 additions and 12 deletions.
  1. +18 −12 auth/ldap/lib.php
@@ -410,6 +410,11 @@ function auth_sync_users ($bulk_insert_records = 1000, $do_updates=1) {
print "connecting to ldap\n";
$ldapconnection = auth_ldap_connect();
if (!$ldapconnection) {
@ldap_close($ldapconnection);
notify("LDAP-module cannot connect to server: $CFG->ldap_host_url");
return false;
}
////
//// get user's list from ldap to sql in a scalable fashion
@@ -447,19 +452,20 @@ function auth_sync_users ($bulk_insert_records = 1000, $do_updates=1) {
array($CFG->ldap_user_attribute));
}
$entry = ldap_first_entry($ldapconnection, $ldap_result);
do {
$value = ldap_get_values_len($ldapconnection, $entry,$CFG->ldap_user_attribute);
$value = $value[0];
$count++;
array_push($fresult, $value);
if(count($fresult) >= $bulk_insert_records){
auth_ldap_bulk_insert($fresult);
//print var_dump($fresult);
$fresult=array();
}
if ($entry = ldap_first_entry($ldapconnection, $ldap_result)) {
do {
$value = ldap_get_values_len($ldapconnection, $entry,$CFG->ldap_user_attribute);
$value = $value[0];
$count++;
array_push($fresult, $value);
if(count($fresult) >= $bulk_insert_records){
auth_ldap_bulk_insert($fresult);
//print var_dump($fresult);
$fresult=array();
}
}
while ($entry = ldap_next_entry($ldapconnection, $entry));
}
while ($entry = ldap_next_entry($ldapconnection, $entry));
// insert any remaining users and release mem
if(count($fresult)){

0 comments on commit 7d49253

Please sign in to comment.
You can’t perform that action at this time.