Skip to content

HTTPS clone URL

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 c9faf6e3b5ec02bae20bdc69cb02f7056983dc3b 1 parent 2b3dbc7
@mrmark mrmark authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 mod/lti/backup/moodle2/restore_lti_stepslib.php
View
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
$this->apply_activity_instance($newitemid);
Please sign in to comment.
Something went wrong with that request. Please try again.