MDL-42772 upgrade: Force alternate fields in session user
This commit is contained in:
@@ -2831,5 +2831,21 @@ function xmldb_main_upgrade($oldversion) {
|
||||
upgrade_main_savepoint(true, 2013110600.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2013110600.02) {
|
||||
|
||||
// If the user is logged in, we ensure that the alternate name fields are present
|
||||
// in the session. It will not be the case when upgrading from 2.5 downwards.
|
||||
if (!empty($USER->id)) {
|
||||
$refreshuser = $DB->get_record('user', array('id' => $USER->id));
|
||||
$fields = array('firstnamephonetic', 'lastnamephonetic', 'middlename', 'alternatename', 'firstname', 'lastname');
|
||||
foreach ($fields as $field) {
|
||||
$USER->{$field} = $refreshuser->{$field};
|
||||
}
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2013110600.02);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$version = 2013110600.01; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
$version = 2013110600.02; // YYYYMMDD = weekly release date of this DEV branch.
|
||||
// RR = release increments - 00 in DEV branches.
|
||||
// .XX = incremental changes.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user