mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-76842 auth_lti: don't update the user unless data has changed
When receiving data from the LTI launch, or service call, only update the user record when we know something has changed. This prevents the creation of many \core\event\user_updated events.
This commit is contained in:
parent
b097d38fb3
commit
0ccf800f01
1 changed files with 5 additions and 1 deletions
|
@ -380,7 +380,11 @@ class auth_plugin_lti extends \auth_plugin_base {
|
||||||
'lastname' => $userdata['family_name'] ?? $iss,
|
'lastname' => $userdata['family_name'] ?? $iss,
|
||||||
'email' => $email
|
'email' => $email
|
||||||
];
|
];
|
||||||
user_update_user($update);
|
$userfieldstocompare = array_intersect_key((array) $user, $update);
|
||||||
|
|
||||||
|
if (!empty(array_diff($update, $userfieldstocompare))) {
|
||||||
|
user_update_user($update); // Only update if there's a change.
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($userdata['picture'])) {
|
if (!empty($userdata['picture'])) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue