added 2 fields in xml, addindex and dropindex, and bug fixes
This commit is contained in:
@@ -21,7 +21,7 @@ function migrate2utf8_chat_name($recordid){
|
||||
/// We are going to use textlib facilities
|
||||
$textlib = textlib_get_instance();
|
||||
/// Convert the text
|
||||
$result = $textlib->convert($assignment->name, $fromenc);
|
||||
$result = $textlib->convert($chat->name, $fromenc);
|
||||
|
||||
$newchat = new object;
|
||||
$newchat->id = $recordid;
|
||||
@@ -53,7 +53,7 @@ function migrate2utf8_chat_intro($recordid){
|
||||
/// We are going to use textlib facilities
|
||||
$textlib = textlib_get_instance();
|
||||
/// Convert the text
|
||||
$result = $textlib->convert($assignment->intro, $fromenc);
|
||||
$result = $textlib->convert($chat->intro, $fromenc);
|
||||
|
||||
$newchat = new object;
|
||||
$newchat->id = $recordid;
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
AND fp.id = RECORDID
|
||||
</SQL_DETECT_COURSE>
|
||||
</FIELD>
|
||||
<FIELD name="attachment" method="NO_CONV" type="varchar" length="0" />
|
||||
<FIELD name="attachment" method="NO_CONV" type="varchar" length="100" />
|
||||
</FIELDS>
|
||||
</TABLE>
|
||||
<TABLE name="forum">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<TABLES>
|
||||
<TABLE name="glossary_entries">
|
||||
<FIELDS>
|
||||
<FIELD name="concept" method="PLAIN_SQL_UPDATE" type="varchar" length="255">
|
||||
<FIELD name="concept" method="PLAIN_SQL_UPDATE" type="varchar" length="255" dropindex="concept" addindex="concept (concept(255))">
|
||||
<SQL_DETECT_USER>
|
||||
SELECT ge.userid
|
||||
FROM {$CFG->prefix}glossary_entries ge
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</TABLE>
|
||||
<TABLE name="hotpot_questions">
|
||||
<FIELDS>
|
||||
<FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
|
||||
<FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255" dropindex="hotpot_questions_name_idx" addindex=" hotpot_questions_name_idx (name(20))">
|
||||
<PHP_FUNCTION>
|
||||
migrate2utf8_hotpot_questions_name(RECORDID)
|
||||
</PHP_FUNCTION>
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<DBMIGRATION type="mod/lesson" VERSION="2005120100">
|
||||
<TABLES>
|
||||
<TABLE name="lesson_attempt">
|
||||
<TABLE name="lesson_attempts">
|
||||
<FIELDS>
|
||||
<FIELD name="useranswer" method="PLAIN_SQL_UPDATE" type="text" length="0">
|
||||
<SQL_DETECT_USER>
|
||||
SELECT la.userid
|
||||
FROM {$CFG->prefix}lesson_attempt la
|
||||
FROM {$CFG->prefix}lesson_attempts la
|
||||
WHERE la.id=RECORDID
|
||||
</SQL_DETECT_USER>
|
||||
<SQL_DETECT_COURSE>
|
||||
SELECT l.course
|
||||
FROM {$CFG->prefix}lesson l,
|
||||
{$CFG->prefix}lesson_attempt la
|
||||
{$CFG->prefix}lesson_attempts la
|
||||
WHERE l.id = la.lessonid
|
||||
AND la.id = RECORDID
|
||||
</SQL_DETECT_COURSE>
|
||||
|
||||
@@ -226,7 +226,7 @@ function migrate2utf8_quiz_match_sub_answertext($recordid){
|
||||
return $result;
|
||||
}
|
||||
|
||||
function migrate2utf8_quiz_answer_answer($recordid){
|
||||
function migrate2utf8_quiz_answers_answer($recordid){
|
||||
global $CFG;
|
||||
|
||||
/// Some trivial checks
|
||||
@@ -272,6 +272,56 @@ function migrate2utf8_quiz_answer_answer($recordid){
|
||||
return $result;
|
||||
}
|
||||
|
||||
function migrate2utf8_quiz_answers_feedback($recordid){
|
||||
global $CFG;
|
||||
|
||||
/// Some trivial checks
|
||||
if (empty($recordid)) {
|
||||
log_the_problem_somewhere();
|
||||
return false;
|
||||
}
|
||||
|
||||
$SQL = "SELECT qc.course
|
||||
FROM {$CFG->prefix}quiz_categories qc,
|
||||
{$CFG->prefix}quiz_questions qq,
|
||||
{$CFG->prefix}quiz_answer qa
|
||||
WHERE qc.id = qq.category
|
||||
AND qq.id = qa.question
|
||||
AND qa.id = $recordid";
|
||||
|
||||
if (!$quiz = get_record_sql($SQL)) {
|
||||
log_the_problem_somewhere();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$quizanswer= get_record('quiz_answer','id',$recordid)) {
|
||||
log_the_problem_somewhere();
|
||||
return false;
|
||||
}
|
||||
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($quiz->course); //Non existing!
|
||||
$userlang = get_main_teacher_lang($quiz->course); //N.E.!!
|
||||
|
||||
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
|
||||
|
||||
/// We are going to use textlib facilities
|
||||
$textlib = textlib_get_instance();
|
||||
/// Convert the text
|
||||
$result = $textlib->convert($quizanswer->feedback, $fromenc);
|
||||
|
||||
$newquizanswer = new object;
|
||||
$newquizanswer->id = $recordid;
|
||||
$newquizanswer->feedback = $result;
|
||||
update_record('quiz_answer',$newquizanswer);
|
||||
/// And finally, just return the converted field
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function migrate2utf8_quiz_dataset_definitions_name($recordid){
|
||||
global $CFG;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
</TABLE>
|
||||
<TABLE name="quiz_multianswers">
|
||||
<FIELDS>
|
||||
<FIELD name="answers" method="NO_CONV" type="varchar" length="255" />
|
||||
<FIELD name="sequence" method="NO_CONV" type="varchar" length="255" />
|
||||
</FIELDS>
|
||||
</TABLE>
|
||||
<TABLE name="quiz_match">
|
||||
@@ -115,17 +115,17 @@
|
||||
</FIELD>
|
||||
</FIELDS>
|
||||
</TABLE>
|
||||
<TABLE name="quiz_answer">
|
||||
<TABLE name="quiz_answers">
|
||||
<FIELDS>
|
||||
<FIELD name="answer" method="PHP_FUNCTION" type="text" length="0">
|
||||
<PHP_FUNCTION>
|
||||
migrate2utf8_quiz_answer_answer(RECORDID)
|
||||
migrate2utf8_quiz_answers_answer(RECORDID)
|
||||
</PHP_FUNCTION>
|
||||
</FIELD>
|
||||
<FIELD name="fraction" method="NO_CONV" type="varchar" length="10" />
|
||||
<FIELD name="feedback" method="PHP_FUNCTION" type="text" length="0">
|
||||
<PHP_FUNCTION>
|
||||
migrate2utf8_quiz_answer_feedback(RECORDID)
|
||||
migrate2utf8_quiz_answers_feedback(RECORDID)
|
||||
</PHP_FUNCTION>
|
||||
</FIELD>
|
||||
</FIELDS>
|
||||
@@ -165,7 +165,6 @@
|
||||
AND qes.id = RECORDID
|
||||
</SQL_DETECT_COURSE>
|
||||
</FIELD>
|
||||
<FIELD name="options" method="NO_CONV" type="varchar" length="255" />
|
||||
</FIELDS>
|
||||
</TABLE>
|
||||
<TABLE name="quiz_categories">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<TABLES>
|
||||
<TABLE name="scorm_scoes_track">
|
||||
<FIELDS>
|
||||
<FIELD name="element" method="PLAIN_SQL_UPDATE" type="varchar" length="255">
|
||||
<FIELD name="element" method="PLAIN_SQL_UPDATE" type="varchar" length="255" dropindex="track" addindex="track (userid, scormid, scoid, attempt, element(255))">
|
||||
<SQL_DETECT_USER>
|
||||
SELECT sst.userid
|
||||
FROM {$CFG->prefix}scorm_scoes_track sst
|
||||
@@ -30,7 +30,6 @@
|
||||
AND sst.id = RECORDID
|
||||
</SQL_DETECT_COURSE>
|
||||
</FIELD>
|
||||
<FIELD name="attachment" method="NO_CONV" type="varchar" length="100" />
|
||||
</FIELDS>
|
||||
</TABLE>
|
||||
<TABLE name="scorm_scoes">
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
</TABLE>
|
||||
<TABLE name="survey_answers">
|
||||
<FIELDS>
|
||||
<FIELD name="answerone" method="PLAIN_SQL_UPDATE" type="text" length="0">
|
||||
<FIELD name="answer1" method="PLAIN_SQL_UPDATE" type="text" length="0">
|
||||
<SQL_DETECT_USER>
|
||||
SELECT sa.userid
|
||||
FROM {$CFG->prefix}survey_answers sa
|
||||
@@ -40,7 +40,7 @@
|
||||
AND sa.id = RECORDID
|
||||
</SQL_DETECT_COURSE>
|
||||
</FIELD>
|
||||
<FIELD name="answertwo" method="PLAIN_SQL_UPDATE" type="text" length="0">
|
||||
<FIELD name="answer2" method="PLAIN_SQL_UPDATE" type="text" length="0">
|
||||
<SQL_DETECT_USER>
|
||||
SELECT sa.userid
|
||||
FROM {$CFG->prefix}survey_answers sa
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<TABLES>
|
||||
<TABLE name="wiki_entries">
|
||||
<FIELDS>
|
||||
<FIELD name="pagename" method="PLAIN_SQL_UPDATE" type="varchar" length="255">
|
||||
<FIELD name="pagename" method="PLAIN_SQL_UPDATE" type="varchar" length="255" dropindex="pagename" addindex="pagename(pagename(255))">
|
||||
<SQL_DETECT_USER>
|
||||
SELECT we.userid
|
||||
FROM {$CFG->prefix}wiki_entries we
|
||||
@@ -20,7 +20,7 @@
|
||||
</TABLE>
|
||||
<TABLE name="wiki_pages">
|
||||
<FIELDS>
|
||||
<FIELD name="pagename" method="PLAIN_SQL_UPDATE" type="varchar" length="160">
|
||||
<FIELD name="pagename" method="PLAIN_SQL_UPDATE" type="varchar" length="160" dropindex="wiki_pages_uk" addindex="wiki_pages_uk(pagename(160), version, wiki)">
|
||||
<SQL_DETECT_USER>
|
||||
SELECT wp.userid
|
||||
FROM {$CFG->prefix}wiki_pages wp
|
||||
@@ -62,7 +62,7 @@
|
||||
AND we.id = RECORDID
|
||||
</SQL_DETECT_COURSE>
|
||||
</FIELD>
|
||||
<FIELD name="ref" method="PLAIN_SQL_UPDATE" type="mediumtext" length="0">
|
||||
<FIELD name="refs" method="PLAIN_SQL_UPDATE" type="mediumtext" length="0">
|
||||
<SQL_DETECT_USER>
|
||||
SELECT wp.userid
|
||||
FROM {$CFG->prefix}wiki_pages wp
|
||||
|
||||
Reference in New Issue
Block a user