MDL-27394 Moodle 2.0 backup and restore may randomise the order of multichoice/numerical/shortanswer answers

This commit is contained in:
Tim Hunt
2011-05-05 19:17:41 +01:00
parent 156816d0b5
commit 7bbe96dc16
3 changed files with 19 additions and 3 deletions
+12 -2
View File
@@ -53,7 +53,12 @@ abstract class backup_qtype_plugin extends backup_plugin {
$answers->add_child($answer);
// Set the sources
$answer->set_source_table('question_answers', array('question' => backup::VAR_PARENTID));
$answer->set_source_sql('
SELECT *
FROM {question_answers}
WHERE question = :question
ORDER BY id',
array('question' => backup::VAR_PARENTID));
// Aliases
$answer->set_source_alias('answer', 'answertext');
@@ -82,7 +87,12 @@ abstract class backup_qtype_plugin extends backup_plugin {
$units->add_child($unit);
// Set the sources
$unit->set_source_table('question_numerical_units', array('question' => backup::VAR_PARENTID));
$unit->set_source_sql('
SELECT *
FROM {question_numerical_units}
WHERE question = :question
ORDER BY id',
array('question' => backup::VAR_PARENTID));
// don't need to annotate ids nor files
}
+1
View File
@@ -2194,6 +2194,7 @@ abstract class restore_activity_structure_step extends restore_structure_step {
/**
* As far as activity restore steps are implementing restore_subplugin stuff, they need to
* have the parent task available for wrapping purposes (get course/context....)
* @return restore_task
*/
public function get_task() {
return $this->task;
@@ -58,7 +58,12 @@ class backup_qtype_match_plugin extends backup_qtype_plugin {
// set source to populate the data
$matchoptions->set_source_table('question_match', array('question' => backup::VAR_PARENTID));
$match->set_source_table('question_match_sub', array('question' => backup::VAR_PARENTID));
$match->set_source_sql('
SELECT *
FROM {question_match_sub}
WHERE question = :question
ORDER BY id',
array('question' => backup::VAR_PARENTID));
// don't need to annotate ids nor files