Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-36336: Prevent duplicate grade items on restore

During restore, lti_add_instance() was being called
and this could generate a grade item.  This would
produce a duplicate item because the restore
process would automatically generate the grade item.
  • Loading branch information...
commit c9af37c4abd4590e16b8319c962102da2f8fbde5 1 parent ff63a3a
@mrmark mrmark authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 mod/lti/backup/moodle2/restore_lti_stepslib.php
6 mod/lti/backup/moodle2/restore_lti_stepslib.php
@@ -64,20 +64,20 @@ protected function define_structure() {
protected function process_lti($data) {
- global $DB, $CFG;
+ global $DB;
$data = (object)$data;
$oldid = $data->id;
$data->course = $this->get_courseid();
+ $data->servicesalt = uniqid('', true);
- require_once($CFG->dirroot.'/mod/lti/lib.php');
// Clean any course or site typeid. All modules
// are restored as self-contained. Note this is
// an interim solution until the issue below is implemented.
// TODO: MDL-34161 - Fix restore to support course/site tools & submissions.
$data->typeid = 0;
- $newitemid = lti_add_instance($data, null);
+ $newitemid = $DB->insert_record('lti', $data);
// immediately after inserting "activity" record, call this
Please sign in to comment.
Something went wrong with that request. Please try again.