MDL-76258 mod_lti: Reset clientid after restore

This commit is contained in:
Stefan Hanauska 2022-11-09 19:32:45 +01:00
parent 57c1e97bf1
commit b8a0ac4808

View File

@ -48,6 +48,7 @@
defined('MOODLE_INTERNAL') || die;
use mod_lti\local\ltiopenid\registration_helper;
/**
* Structure step to restore one lti activity
*/
@ -134,6 +135,9 @@ class restore_lti_activity_structure_step extends restore_activity_structure_ste
$this->newltitype = false;
if (!$ltitypeid && $data->course == $courseid) {
unset($data->toolproxyid); // Course tools can not use LTI2.
if (!empty($data->clientid)) {
$data->clientid = registration_helper::get()->new_clientid(); // Need to rebuild clientid to ensure uniqueness.
}
$ltitypeid = $DB->insert_record('lti_types', $data);
$this->newltitype = true;
$this->set_mapping('ltitype', $oldid, $ltitypeid);