Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'MDL-32614_22' of git://github.com/stronk7/moodle into M…

…OODLE_22_STABLE
  • Loading branch information...
commit e0c7cb6ffa8b3a85484368c381e770c8536c5492 2 parents dc6451c + 7351ed0
Sam Hemelryk samhemelryk authored
12 mod/lti/backup/moodle2/backup_lti_stepslib.php
@@ -56,11 +56,13 @@ class backup_lti_activity_structure_step extends backup_activity_structure_step
56 56
57 57 protected function define_structure() {
58 58
  59 + // TODO: MDL-34161 - Fix restore to support course/site tools & submissions.
  60 +
59 61 // To know if we are including userinfo
60 62 $userinfo = $this->get_setting_value('userinfo');
61 63
62 64 // Define each element separated
63   - $basiclti = new backup_nested_element('lti', array('id'), array(
  65 + $lti = new backup_nested_element('lti', array('id'), array(
64 66 'name',
65 67 'intro',
66 68 'introformat',
@@ -86,15 +88,15 @@ protected function define_structure() {
86 88 // (none)
87 89
88 90 // Define sources
89   - $basiclti->set_source_table('lti', array('id' => backup::VAR_ACTIVITYID));
  91 + $lti->set_source_table('lti', array('id' => backup::VAR_ACTIVITYID));
90 92
91 93 // Define id annotations
92 94 // (none)
93 95
94 96 // Define file annotations
95   - $basiclti->annotate_files('mod_lti', 'intro', null); // This file areas haven't itemid
  97 + $lti->annotate_files('mod_lti', 'intro', null); // This file areas haven't itemid
96 98
97   - // Return the root element (basiclti), wrapped into standard activity structure
98   - return $this->prepare_activity_structure($basiclti);
  99 + // Return the root element (lti), wrapped into standard activity structure
  100 + return $this->prepare_activity_structure($lti);
99 101 }
100 102 }
27 mod/lti/backup/moodle2/restore_lti_stepslib.php
@@ -50,7 +50,7 @@
50 50 defined('MOODLE_INTERNAL') || die;
51 51
52 52 /**
53   - * Structure step to restore one basiclti activity
  53 + * Structure step to restore one lti activity
54 54 */
55 55 class restore_lti_activity_structure_step extends restore_activity_structure_step {
56 56
@@ -71,33 +71,20 @@ protected function process_lti($data) {
71 71 $data->course = $this->get_courseid();
72 72
73 73 require_once($CFG->dirroot.'/mod/lti/lib.php');
  74 + // Clean any course or site typeid. All modules
  75 + // are restored as self-contained. Note this is
  76 + // an interim solution until the issue below is implemented.
  77 + // TODO: MDL-34161 - Fix restore to support course/site tools & submissions.
  78 + $data->typeid = 0;
74 79
75 80 $newitemid = lti_add_instance($data, null);
76 81
77   - // insert the basiclti record
78   - //$newitemid = $DB->insert_record('lti', $data);
79 82 // immediately after inserting "activity" record, call this
80 83 $this->apply_activity_instance($newitemid);
81 84 }
82 85
83 86 protected function after_execute() {
84   - global $DB;
85   -
86   - $basicltis = $DB->get_records('lti');
87   - foreach ($basicltis as $basiclti) {
88   - if (!$DB->get_record('lti_types_config',
89   - array('typeid' => $basiclti->typeid, 'name' => 'toolurl', 'value' => $basiclti->toolurl))) {
90   -
91   - $basiclti->typeid = 0;
92   - }
93   -
94   - $basiclti->placementsecret = uniqid('', true);
95   - $basiclti->timeplacementsecret = time();
96   -
97   - $DB->update_record('lti', $basiclti);
98   - }
99   -
100   - // Add basiclti related files, no need to match by itemname (just internally handled context)
  87 + // Add lti related files, no need to match by itemname (just internally handled context)
101 88 $this->add_related_files('mod_lti', 'intro', null);
102 89 }
103 90 }

0 comments on commit e0c7cb6

Please sign in to comment.
Something went wrong with that request. Please try again.