MDL-86043 core: keep SQL consistent with other Moodle versions.
This change resolves issues with Oracle in Moodle 4.5. It has been ported to newer Moodle versions as it improves the existing SQL and helps maintain consistency across different Moodle versions.
This commit is contained in:
@@ -55,6 +55,7 @@ class send_new_user_passwords_task extends scheduled_task {
|
||||
mtrace('Creating passwords for new users...');
|
||||
$userfieldsapi = \core_user\fields::for_name();
|
||||
$usernamefields = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
|
||||
[$sort, $sortparams] = users_order_by_sql('u');
|
||||
$newusers = $DB->get_recordset_sql("SELECT u.id as id, u.email, u.auth, u.deleted,
|
||||
u.suspended, u.emailstop, u.mnethostid, u.mailformat,
|
||||
$usernamefields, u.username, u.lang,
|
||||
@@ -66,7 +67,8 @@ class send_new_user_passwords_task extends scheduled_task {
|
||||
AND u.email <> ''
|
||||
AND u.suspended = 0
|
||||
AND u.auth <> 'nologin'
|
||||
AND u.deleted = 0");
|
||||
AND u.deleted = 0
|
||||
ORDER BY $sort ASC", $sortparams);
|
||||
|
||||
// Note: we can not send emails to suspended accounts.
|
||||
foreach ($newusers as $newuser) {
|
||||
|
||||
Reference in New Issue
Block a user