mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 04:30:15 +01:00
Made sure the questions that can be parent questions are backed up and restored first so that the recoding of the parent field will work.
This commit is contained in:
parent
2e1111c5b1
commit
9a62a7634b
@ -247,8 +247,11 @@
|
||||
|
||||
$status = true;
|
||||
|
||||
$questions = get_records("quiz_questions","category",$category,"id");
|
||||
//If there is questions
|
||||
// We'll fetch the questions sorted by parent so that questions with no parents
|
||||
// (these are the ones which could be parents themselves) are backed up first. This
|
||||
// is important for the recoding of the parent field during the restore process
|
||||
$questions = get_records("quiz_questions","category",$category,"parent ASC, id");
|
||||
//If there are questions
|
||||
if ($questions) {
|
||||
//Write start tag
|
||||
$status =fwrite ($bf,start_tag("QUESTIONS",4,true));
|
||||
|
@ -203,6 +203,8 @@
|
||||
$question->hidden = backup_todb($que_info['#']['HIDDEN']['0']['#']);
|
||||
|
||||
////We have to recode the parent field
|
||||
// This should work alright because we ordered the questions appropriately during backup so that
|
||||
// questions that can be parents are restored first
|
||||
if ($question->parent and $parent = backup_getid($restore->backup_unique_code,"quiz_questions",$question->parent)) {
|
||||
$question->parent = $parent->new_id;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user