mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
see changes for admin/utfdbmigrate.php
This commit is contained in:
parent
e98ae339ef
commit
f841494c62
24 changed files with 1537 additions and 1019 deletions
|
@ -1,7 +1,7 @@
|
|||
<?
|
||||
|
||||
function migrate2utf8_survey_name($recordid){
|
||||
global $CFG;
|
||||
global $CFG, $globallang;
|
||||
|
||||
/// Some trivial checks
|
||||
if (empty($recordid)) {
|
||||
|
@ -14,27 +14,33 @@ function migrate2utf8_survey_name($recordid){
|
|||
return false;
|
||||
}
|
||||
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($survey->course); //Non existing!
|
||||
$userlang = get_main_teacher_lang($survey->course); //N.E.!!
|
||||
if ($globallang) {
|
||||
$fromenc = $globallang;
|
||||
} else {
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($survey->course); //Non existing!
|
||||
$userlang = get_main_teacher_lang($survey->course); //N.E.!!
|
||||
|
||||
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
|
||||
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
|
||||
}
|
||||
|
||||
/// We are going to use textlib facilities
|
||||
|
||||
/// Convert the text
|
||||
$result = utfconvert($survey->name, $fromenc);
|
||||
if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
|
||||
$result = utfconvert($survey->name, $fromenc);
|
||||
|
||||
$newsurvey = new object;
|
||||
$newsurvey->id = $recordid;
|
||||
$newsurvey->name = $result;
|
||||
update_record('survey',$newsurvey);
|
||||
$newsurvey = new object;
|
||||
$newsurvey->id = $recordid;
|
||||
$newsurvey->name = $result;
|
||||
update_record('survey',$newsurvey);
|
||||
}
|
||||
/// And finally, just return the converted field
|
||||
return $result;
|
||||
}
|
||||
|
||||
function migrate2utf8_survey_intro($recordid){
|
||||
global $CFG;
|
||||
global $CFG, $globallang;
|
||||
|
||||
/// Some trivial checks
|
||||
if (empty($recordid)) {
|
||||
|
@ -46,22 +52,27 @@ function migrate2utf8_survey_intro($recordid){
|
|||
log_the_problem_somewhere();
|
||||
return false;
|
||||
}
|
||||
if ($globallang) {
|
||||
$fromenc = $globallang;
|
||||
} else {
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($survey->course); //Non existing!
|
||||
$userlang = get_main_teacher_lang($survey->course); //N.E.!!
|
||||
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($survey->course); //Non existing!
|
||||
$userlang = get_main_teacher_lang($survey->course); //N.E.!!
|
||||
|
||||
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
|
||||
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
|
||||
}
|
||||
|
||||
/// We are going to use textlib facilities
|
||||
|
||||
/// Convert the text
|
||||
$result = utfconvert($survey->intro, $fromenc);
|
||||
if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
|
||||
$result = utfconvert($survey->intro, $fromenc);
|
||||
|
||||
$newsurvey = new object;
|
||||
$newsurvey->id = $recordid;
|
||||
$newsurvey->intro = $result;
|
||||
update_record('survey',$newsurvey);
|
||||
$newsurvey = new object;
|
||||
$newsurvey->id = $recordid;
|
||||
$newsurvey->intro = $result;
|
||||
update_record('survey',$newsurvey);
|
||||
}
|
||||
/// And finally, just return the converted field
|
||||
return $result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue