mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 07:56:06 +02:00
MDL-51855 mod_question: fix offset error during upgrade
This commit is contained in:
parent
9382ac38d6
commit
abc2491211
@ -118,7 +118,8 @@ class restore_qtype_multianswer_plugin extends restore_qtype_plugin {
|
||||
question_bank::get_qtype($wrapped->qtype)->get_question_options($wrapped);
|
||||
if (isset($wrapped->options->shuffleanswers)) {
|
||||
preg_match('/'.ANSWER_REGEX.'/s', $wrapped->questiontext, $answerregs);
|
||||
if ($answerregs[ANSWER_REGEX_ANSWER_TYPE_MULTICHOICE] != '' ) {
|
||||
if (isset($answerregs[ANSWER_REGEX_ANSWER_TYPE_MULTICHOICE]) &&
|
||||
$answerregs[ANSWER_REGEX_ANSWER_TYPE_MULTICHOICE] !== '') {
|
||||
$wrapped->options->shuffleanswers = 0;
|
||||
$DB->set_field_select('qtype_multichoice_options', 'shuffleanswers', '0', "id =:select",
|
||||
array('select' => $wrapped->options->id) );
|
||||
|
@ -76,7 +76,8 @@ function xmldb_qtype_multianswer_upgrade($oldversion) {
|
||||
$options = $DB->get_record('qtype_multichoice_options', array('questionid' => $wrapped->id), '*');
|
||||
if (isset($options->shuffleanswers)) {
|
||||
preg_match('/'.ANSWER_REGEX.'/s', $wrapped->questiontext, $answerregs);
|
||||
if ($answerregs[ANSWER_REGEX_ANSWER_TYPE_MULTICHOICE] != '' ) {
|
||||
if (isset($answerregs[ANSWER_REGEX_ANSWER_TYPE_MULTICHOICE]) &&
|
||||
$answerregs[ANSWER_REGEX_ANSWER_TYPE_MULTICHOICE] !== '') {
|
||||
$DB->set_field('qtype_multichoice_options', 'shuffleanswers', '0',
|
||||
array('id' => $options->id) );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user