From 4919564de9dab6cde05c4bce91f46e8e5f9211e2 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Tue, 6 Jun 2006 14:15:48 +0000 Subject: [PATCH] Fix notices from the quiz module on backup and restore. Merged from MOODLE_16_STABLE. --- mod/quiz/restorelib.php | 8 ++++++-- question/restorelib.php | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/mod/quiz/restorelib.php b/mod/quiz/restorelib.php index 3f225a9c09..c001f2bae0 100644 --- a/mod/quiz/restorelib.php +++ b/mod/quiz/restorelib.php @@ -189,8 +189,12 @@ $status = true; //Get the quiz_question_versions array - $versions = $info['MOD']['#']['QUESTION_VERSIONS']['0']['#']['QUESTION_VERSION']; - + if (!empty($info['MOD']['#']['QUESTION_VERSIONS'])) { + $versions = $info['MOD']['#']['QUESTION_VERSIONS']['0']['#']['QUESTION_VERSION']; + } else { + $versions = array(); + } + //Iterate over question_versions for($i = 0; $i < sizeof($versions); $i++) { $ver_info = $versions[$i]; diff --git a/question/restorelib.php b/question/restorelib.php index b9c6045407..a28238fe8b 100644 --- a/question/restorelib.php +++ b/question/restorelib.php @@ -114,7 +114,7 @@ $question_cat->parent = backup_todb($info['QUESTION_CATEGORY']['#']['PARENT']['0']['#']); $question_cat->sortorder = backup_todb($info['QUESTION_CATEGORY']['#']['SORTORDER']['0']['#']); - if ($catfound = restore_get_best_question_category($question_cat, $restore->course)) { + if ($catfound = restore_get_best_question_category($question_cat, $restore->course_id)) { $newid = $catfound; } else { if (!$question_cat->stamp) { @@ -165,7 +165,11 @@ $restored_questions = array(); //Get the questions array - $questions = $info['QUESTION_CATEGORY']['#']['QUESTIONS']['0']['#']['QUESTION']; + if (!empty($info['QUESTION_CATEGORY']['#']['QUESTIONS'])) { + $questions = $info['QUESTION_CATEGORY']['#']['QUESTIONS']['0']['#']['QUESTION']; + } else { + $questions = array(); + } //Iterate over questions for($i = 0; $i < sizeof($questions); $i++) { -- 2.39.5