Commit 4148ee3b authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic
Browse files

Bug 1818901: mysql upgrade fix - User creation not set passwordchange

behatnotneede

Change-Id: Ifabbb291391e60caa57d5d2421ad41402a70a6f7
parent c7001577
Loading
Loading
Loading
Loading
+17 −7
Original line number Diff line number Diff line
@@ -1363,6 +1363,15 @@ function xmldb_core_upgrade($oldversion=0) {

    if ($oldversion < 2019062600) {
        log_debug('Remove force password change for those using external auth');
        if (is_mysql()) {
            execute_sql("UPDATE {usr} u
                         JOIN {auth_instance} ui
                         ON ui.id = u.authinstance
                         SET passwordchange = 0
                         WHERE ui.authname != 'internal' AND ui.active = 1 AND u.id != 0
                         ");
        }
        else {
            execute_sql("UPDATE {usr} SET passwordchange = 0
             WHERE id IN (
                 SELECT u.id FROM {usr} u
@@ -1371,6 +1380,7 @@ function xmldb_core_upgrade($oldversion=0) {
             )
             AND id != 0"); // Ignore the root user
        }
    }

    return $status;
}