diff --git a/auth/ldap/auth.php b/auth/ldap/auth.php index b57ede32866..b8a2f11171b 100644 --- a/auth/ldap/auth.php +++ b/auth/ldap/auth.php @@ -866,11 +866,8 @@ class auth_plugin_ldap extends auth_plugin_base { if (!empty($users)) { print_string('userentriestoupdate', 'auth_ldap', count($users)); - $transaction = $DB->start_delegated_transaction(); - $xcount = 0; - $maxxcount = 100; - foreach ($users as $user) { + $transaction = $DB->start_delegated_transaction(); echo "\t"; print_string('auth_dbupdatinguser', 'auth_db', array('name'=>$user->username, 'id'=>$user->id)); $userinfo = $this->get_userinfo($user->username); if (!$this->update_user_record($user->username, $updatekeys, true, @@ -878,12 +875,11 @@ class auth_plugin_ldap extends auth_plugin_base { echo ' - '.get_string('skipped'); } echo "\n"; - $xcount++; // Update system roles, if needed. $this->sync_roles($user); + $transaction->allow_commit(); } - $transaction->allow_commit(); unset($users); // free mem } } else { // end do updates @@ -903,8 +899,8 @@ class auth_plugin_ldap extends auth_plugin_base { if (!empty($add_users)) { print_string('userentriestoadd', 'auth_ldap', count($add_users)); - $transaction = $DB->start_delegated_transaction(); foreach ($add_users as $user) { + $transaction = $DB->start_delegated_transaction(); $user = $this->get_userinfo_asobj($user->username); // Prep a few params @@ -939,9 +935,8 @@ class auth_plugin_ldap extends auth_plugin_base { // Add roles if needed. $this->sync_roles($euser); - + $transaction->allow_commit(); } - $transaction->allow_commit(); unset($add_users); // free mem } else { print_string('nouserstobeadded', 'auth_ldap');