mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +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,6 +1,6 @@
|
|||
<?
|
||||
function migrate2utf8_lams_name($recordid){
|
||||
global $CFG;
|
||||
global $CFG, $globallang;
|
||||
|
||||
/// Some trivial checks
|
||||
if (empty($recordid)) {
|
||||
|
@ -13,27 +13,33 @@ function migrate2utf8_lams_name($recordid){
|
|||
return false;
|
||||
}
|
||||
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($lams->course); //Non existing!
|
||||
$userlang = get_main_teacher_lang($lams->course); //N.E.!!
|
||||
if ($globallang) {
|
||||
$fromenc = $globallang;
|
||||
} else {
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($lams->course); //Non existing!
|
||||
$userlang = get_main_teacher_lang($lams->course); //N.E.!!
|
||||
|
||||
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
|
||||
}
|
||||
|
||||
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
|
||||
echo "lamslamslams ".$fromenc;
|
||||
/// We are going to use textlib facilities
|
||||
|
||||
/// Convert the text
|
||||
$result = utfconvert($lams->name, $fromenc);
|
||||
if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
|
||||
$result = utfconvert($lams->name, $fromenc);
|
||||
|
||||
$newlams = new object;
|
||||
$newlams->id = $recordid;
|
||||
$newlams->name = $result;
|
||||
update_record('lams',$newlams);
|
||||
$newlams = new object;
|
||||
$newlams->id = $recordid;
|
||||
$newlams->name = $result;
|
||||
update_record('lams',$newlams);
|
||||
}
|
||||
/// And finally, just return the converted field
|
||||
return $result;
|
||||
}
|
||||
|
||||
function migrate2utf8_lams_introduction($recordid){
|
||||
global $CFG;
|
||||
global $CFG, $globallang;
|
||||
|
||||
/// Some trivial checks
|
||||
if (empty($recordid)) {
|
||||
|
@ -45,22 +51,27 @@ function migrate2utf8_lams_introduction($recordid){
|
|||
log_the_problem_somewhere();
|
||||
return false;
|
||||
}
|
||||
if ($globallang) {
|
||||
$fromenc = $globallang;
|
||||
} else {
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($lams->course); //Non existing!
|
||||
$userlang = get_main_teacher_lang($lams->course); //N.E.!!
|
||||
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($lams->course); //Non existing!
|
||||
$userlang = get_main_teacher_lang($lams->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($lams->introduction, $fromenc);
|
||||
if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
|
||||
$result = utfconvert($lams->introduction, $fromenc);
|
||||
|
||||
$newlams = new object;
|
||||
$newlams->id = $recordid;
|
||||
$newlams->introduction = $result;
|
||||
update_record('lams',$newlams);
|
||||
$newlams = new object;
|
||||
$newlams->id = $recordid;
|
||||
$newlams->introduction = $result;
|
||||
update_record('lams',$newlams);
|
||||
}
|
||||
/// And finally, just return the converted field
|
||||
return $result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue