From ea889e7744a380ccff8dbaaffe56ceaddb57568b Mon Sep 17 00:00:00 2001 From: gustav_delius Date: Wed, 22 Mar 2006 10:32:29 +0000 Subject: [PATCH] Recode qtypes during restore of old backups. --- question/restorelib.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/question/restorelib.php b/question/restorelib.php index b4ec6893ba..0b7fedf422 100644 --- a/question/restorelib.php +++ b/question/restorelib.php @@ -192,6 +192,14 @@ $question->version = backup_todb($que_info['#']['VERSION']['0']['#']); $question->hidden = backup_todb($que_info['#']['HIDDEN']['0']['#']); + if ($restore->backup_version < 2006032200) { + // The qtype was an integer that now needs to be converted to the name + $qtypenames = array(1=>'shortanswer',2=>'truefalse',3=>'multichoice',4=>'random',5=>'match', + 6=>'randomsamatch',7=>'description',8=>'numerical',9=>'multianswer',10=>'calculated', + 11=>'rqp',12=>'essay'); + $question->qtype = $qtypenames[$question->qtype]; + } + ////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 -- 2.39.5