diff --git a/lib/db/migrate2utf8.xml b/lib/db/migrate2utf8.xml index c7e67fa2f57..c04acad68a6 100755 --- a/lib/db/migrate2utf8.xml +++ b/lib/db/migrate2utf8.xml @@ -342,6 +342,8 @@
+ + migrate2utf8_course_password(RECORDID) diff --git a/mod/data/db/migrate2utf8.php b/mod/data/db/migrate2utf8.php index 4cbb53341ef..5dde2c34010 100755 --- a/mod/data/db/migrate2utf8.php +++ b/mod/data/db/migrate2utf8.php @@ -328,6 +328,46 @@ function migrate2utf8_data_rsstemplate($recordid){ return $result; } + +function migrate2utf8_data_csstemplate($recordid){ + global $CFG, $globallang; + +/// Some trivial checks + if (empty($recordid)) { + log_the_problem_somewhere(); + return false; + } + + if (!$data = get_record('data','id',$recordid)) { + log_the_problem_somewhere(); + return false; + } + + if ($globallang) { + $fromenc = $globallang; + } else { + $sitelang = $CFG->lang; + $courselang = get_course_lang($data->course); //Non existing! + $userlang = get_main_teacher_lang($data->course); //N.E.!! + $fromenc = get_original_encoding($sitelang, $courselang, $userlang); + } + +/// We are going to use textlib facilities + +/// Convert the text + if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) { + $result = utfconvert($data->csstemplate, $fromenc); + + $newdata= new object; + $newdata->id = $recordid; + $newdata->csstemplate = $result; + migrate2utf8_update_record('data',$newdata); + } +/// And finally, just return the converted field + return $result; +} + + function migrate2utf8_data_listtemplateheader($recordid){ global $CFG, $globallang; diff --git a/mod/data/db/migrate2utf8.xml b/mod/data/db/migrate2utf8.xml index 832b40837a8..fa48f5dd443 100755 --- a/mod/data/db/migrate2utf8.xml +++ b/mod/data/db/migrate2utf8.xml @@ -148,6 +148,11 @@ migrate2utf_data_listtemplate(RECORDID) + + + migrate2utf_data_csstemplate(RECORDID) + + migrate2utf_data_addtemplate(RECORDID) diff --git a/mod/quiz/db/migrate2utf8.xml b/mod/quiz/db/migrate2utf8.xml index b5e0f8e31d6..de721ad4e64 100755 --- a/mod/quiz/db/migrate2utf8.xml +++ b/mod/quiz/db/migrate2utf8.xml @@ -39,7 +39,28 @@
- +
+ + + + SELECT qa.userid + FROM {$CFG->prefix}question_sessions qs, + {$CFG->prefix}quiz_attempts qa + WHERE qa.id = qs.attemptid + AND qs.id = RECORDID + + + SELECT q.course + FROM {$CFG->prefix}quiz q, + {$CFG->prefix}question_sessions qs, + {$CFG->prefix}quiz_attempts qa + WHERE q.id = qa.quiz + AND qa.id = qs.attemptid + AND qs.id = RECORDID + + + +
@@ -109,6 +130,7 @@ migrate2utf8_question_qtype(RECORDID) + migrate2utf8_question_questiontext(RECORDID)