mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
Merge branch 'MDL-49247' of git://github.com/timhunt/moodle
This commit is contained in:
commit
5ce0741490
@ -104,8 +104,13 @@ class restore_qtype_match_plugin extends restore_qtype_plugin {
|
||||
|
||||
// Adjust some columns.
|
||||
$data->questionid = $newquestionid;
|
||||
$newitemid = $DB->insert_record('qtype_match_options', $data);
|
||||
$this->set_mapping('qtype_match_options', $oldid, $newitemid);
|
||||
|
||||
// It is possible for old backup files to contain unique key violations.
|
||||
// We need to check to avoid that.
|
||||
if (!$DB->record_exists('qtype_match_options', array('questionid' => $data->questionid))) {
|
||||
$newitemid = $DB->insert_record('qtype_match_options', $data);
|
||||
$this->set_mapping('qtype_match_options', $oldid, $newitemid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -70,12 +70,14 @@ class restore_qtype_multichoice_plugin extends restore_qtype_plugin {
|
||||
// If the question has been created by restore, we need to create its
|
||||
// qtype_multichoice_options too.
|
||||
if ($questioncreated) {
|
||||
// Adjust some columns.
|
||||
$data->questionid = $newquestionid;
|
||||
// Insert record.
|
||||
$newitemid = $DB->insert_record('qtype_multichoice_options', $data);
|
||||
// Create mapping (needed for decoding links).
|
||||
$this->set_mapping('qtype_multichoice_options', $oldid, $newitemid);
|
||||
|
||||
// It is possible for old backup files to contain unique key violations.
|
||||
// We need to check to avoid that.
|
||||
if (!$DB->record_exists('qtype_multichoice_options', array('questionid' => $data->questionid))) {
|
||||
$newitemid = $DB->insert_record('qtype_multichoice_options', $data);
|
||||
$this->set_mapping('qtype_multichoice_options', $oldid, $newitemid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,12 +86,14 @@ class restore_qtype_randomsamatch_plugin extends restore_qtype_plugin {
|
||||
if (!isset($data->shownumcorrect)) {
|
||||
$data->shownumcorrect = 0;
|
||||
}
|
||||
// Adjust some columns.
|
||||
$data->questionid = $newquestionid;
|
||||
// Insert record.
|
||||
$newitemid = $DB->insert_record('qtype_randomsamatch_options', $data);
|
||||
// Create mapping.
|
||||
$this->set_mapping('qtype_randomsamatch_options', $oldid, $newitemid);
|
||||
|
||||
// It is possible for old backup files to contain unique key violations.
|
||||
// We need to check to avoid that.
|
||||
if (!$DB->record_exists('qtype_randomsamatch_options', array('questionid' => $data->questionid))) {
|
||||
$newitemid = $DB->insert_record('qtype_randomsamatch_options', $data);
|
||||
$this->set_mapping('qtype_randomsamatch_options', $oldid, $newitemid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -71,8 +71,13 @@ class restore_qtype_shortanswer_plugin extends restore_qtype_plugin {
|
||||
// qtype_shortanswer_options too, if they are defined (the gui should ensure this).
|
||||
if ($questioncreated) {
|
||||
$data->questionid = $newquestionid;
|
||||
$newitemid = $DB->insert_record('qtype_shortanswer_options', $data);
|
||||
$this->set_mapping('qtype_shortanswer_options', $oldid, $newitemid);
|
||||
|
||||
// It is possible for old backup files to contain unique key violations.
|
||||
// We need to check to avoid that.
|
||||
if (!$DB->record_exists('qtype_shortanswer_options', array('questionid' => $data->questionid))) {
|
||||
$newitemid = $DB->insert_record('qtype_shortanswer_options', $data);
|
||||
$this->set_mapping('qtype_shortanswer_options', $oldid, $newitemid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user