Merge branch 'MDL-76258-master' of https://github.com/sh-csg/moodle

This commit is contained in:
Andrew Nicols 2022-11-29 12:27:53 +08:00
commit 392a0030a3

View File

@ -48,6 +48,7 @@
defined('MOODLE_INTERNAL') || die; defined('MOODLE_INTERNAL') || die;
use mod_lti\local\ltiopenid\registration_helper;
/** /**
* Structure step to restore one lti activity * 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; $this->newltitype = false;
if (!$ltitypeid && $data->course == $courseid) { if (!$ltitypeid && $data->course == $courseid) {
unset($data->toolproxyid); // Course tools can not use LTI2. 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); $ltitypeid = $DB->insert_record('lti_types', $data);
$this->newltitype = true; $this->newltitype = true;
$this->set_mapping('ltitype', $oldid, $ltitypeid); $this->set_mapping('ltitype', $oldid, $ltitypeid);