mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-57193 auth_db: Use a recordset and array_key_exists
This commit is contained in:
parent
34949c1a55
commit
ec3e79134f
@ -307,12 +307,15 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
FROM {user} u
|
||||
WHERE u.auth=:authtype AND u.deleted=0 AND u.mnethostid=:mnethostid $suspendselect";
|
||||
$params['mnethostid'] = $CFG->mnet_localhost_id;
|
||||
$internalusers = $DB->get_records_sql($sql, $params);
|
||||
foreach ($internalusers as $internaluser) {
|
||||
if (!in_array($internaluser->username, $userlist)) {
|
||||
$internalusersrs = $DB->get_recordset_sql($sql, $params);
|
||||
foreach ($internalusersrs as $internaluser) {
|
||||
// Arrange the associative array.
|
||||
$usernamelist = array_flip($userlist);
|
||||
if (!array_key_exists($internaluser->username, $usernamelist)) {
|
||||
$removeusers[] = $internaluser;
|
||||
}
|
||||
}
|
||||
$internalusersrs->close();
|
||||
} else {
|
||||
$sql = "SELECT u.id, u.username
|
||||
FROM {user} u
|
||||
|
Loading…
x
Reference in New Issue
Block a user