MDL-45242 Lib: Replace calls to deprecated functions

In all cases changes have been kept to a minimum while not making
the code completely horrible. For example, there are many instances
where it would probably be better to rewrite a query entirely, but
I have not done that (in order to reduce the risk of changes).
This commit is contained in:
sam marshall
2021-03-10 10:58:09 +00:00
parent 5b7b1b9a06
commit 0919a04311
152 changed files with 612 additions and 394 deletions
@@ -115,7 +115,8 @@ class send_failed_login_notifications_task extends scheduled_task {
// Now, select all the login error logged records belonging to the ips and infos
// since lastnotifyfailure, that we have stored in the cache_flags table.
$namefields = get_all_user_name_fields(true, 'u');
$userfieldsapi = \core\user_fields::for_name();
$namefields = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
$sql = "SELECT * FROM (
SELECT l.*, u.username, $namefields
FROM {" . $logtable . "} l
@@ -47,7 +47,8 @@ class send_new_user_passwords_task extends scheduled_task {
// Generate new password emails for users - ppl expect these generated asap.
if ($DB->count_records('user_preferences', array('name' => 'create_password', 'value' => '1'))) {
mtrace('Creating passwords for new users...');
$usernamefields = get_all_user_name_fields(true, 'u');
$userfieldsapi = \core\user_fields::for_name();
$usernamefields = $userfieldsapi->get_sql('u', false, '', '', false)->selects;
$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,