mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-57193 auth_db: Flip the array outside the loop for better perf
Also as the recent changes where affecting the whitespaces quite a lot, I took the liberty of aligning a few lines which weren't.
This commit is contained in:
parent
ec3e79134f
commit
7fc7486f49
@ -302,15 +302,18 @@ class auth_plugin_db extends auth_plugin_base {
|
||||
// Find obsolete users.
|
||||
if (count($userlist)) {
|
||||
$removeusers = array();
|
||||
$params['authtype'] = $this->authtype;
|
||||
$sql = "SELECT u.id, u.username
|
||||
FROM {user} u
|
||||
WHERE u.auth=:authtype AND u.deleted=0 AND u.mnethostid=:mnethostid $suspendselect";
|
||||
$params['mnethostid'] = $CFG->mnet_localhost_id;
|
||||
$internalusersrs = $DB->get_recordset_sql($sql, $params);
|
||||
$params['authtype'] = $this->authtype;
|
||||
$sql = "SELECT u.id, u.username
|
||||
FROM {user} u
|
||||
WHERE u.auth=:authtype
|
||||
AND u.deleted=0
|
||||
AND u.mnethostid=:mnethostid
|
||||
$suspendselect";
|
||||
$params['mnethostid'] = $CFG->mnet_localhost_id;
|
||||
$internalusersrs = $DB->get_recordset_sql($sql, $params);
|
||||
|
||||
$usernamelist = array_flip($userlist);
|
||||
foreach ($internalusersrs as $internaluser) {
|
||||
// Arrange the associative array.
|
||||
$usernamelist = array_flip($userlist);
|
||||
if (!array_key_exists($internaluser->username, $usernamelist)) {
|
||||
$removeusers[] = $internaluser;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user