MDL-52203 qtype_multianswer: avoid fatal error during upgrade

This commit is contained in:
Marina Glancy
2015-11-19 09:45:28 +01:00
committed by Eloy Lafuente (stronk7)
parent e06768b331
commit 40e33b6e75
+3 -3
View File
@@ -65,10 +65,10 @@ function xmldb_qtype_multianswer_upgrade($oldversion) {
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), '*');