Merge branch 'wip-MDL-52203-master' of https://github.com/marinaglancy/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Thu, 19 Nov 2015 08:43:19 +0000 (09:43 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Thu, 19 Nov 2015 08:45:30 +0000 (09:45 +0100)
1  2 
question/type/multianswer/db/upgrade.php

@@@ -26,6 -26,8 +26,6 @@@
  
  defined('MOODLE_INTERNAL') || die();
  
 -require_once($CFG->dirroot . '/question/type/multianswer/questiontype.php');
 -
  /**
   * Upgrade code for the multi-answer question type.
   * @param int $oldversion the version we are upgrading from.
@@@ -65,10 -67,10 +65,10 @@@ function xmldb_qtype_multianswer_upgrad
                   FROM {question} q
                   JOIN {question_multianswer} qma ON q.id = qma.question");
          foreach ($rs as $q) {
-             if (!empty($q->sequence)) {
+             $sequence = preg_split('/,/', $q->sequence, -1, PREG_SPLIT_NO_EMPTY);
+             if ($sequence) {
                  // Get relevant data indexed by positionkey from the multianswers table.
-                 $wrappedquestions = $DB->get_records_list('question', 'id',
-                         explode(',', $q->sequence), 'id ASC');
+                 $wrappedquestions = $DB->get_records_list('question', 'id', $sequence, 'id ASC');
                  foreach ($wrappedquestions as $wrapped) {
                      if ($wrapped->qtype == 'multichoice') {
                          $options = $DB->get_record('qtype_multichoice_options', array('questionid' => $wrapped->id), '*');
@@@ -96,8 -98,5 +96,8 @@@
          upgrade_plugin_savepoint(true, 2015100201, 'qtype', 'multianswer');
      }
  
 +    // Moodle v3.0.0 release upgrade line.
 +    // Put any upgrade step following this.
 +
      return true;
  }