mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +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_hotpot_strings_string($recordid){
|
||||
global $CFG;
|
||||
global $CFG, $globallang;
|
||||
|
||||
/// Some trivial checks
|
||||
if (empty($recordid)) {
|
||||
|
@ -14,27 +14,33 @@ function migrate2utf8_hotpot_strings_string($recordid){
|
|||
return false;
|
||||
}
|
||||
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = null; //Non existing!
|
||||
$userlang = null; //N.E.!!
|
||||
if ($globallang) {
|
||||
$fromenc = $globallang;
|
||||
} else {
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = null; //Non existing!
|
||||
$userlang = null; //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($hotpotstrings->string, $fromenc);
|
||||
if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
|
||||
$result = utfconvert($hotpotstrings->string, $fromenc);
|
||||
|
||||
$newhotpotstrings = new object;
|
||||
$newhotpotstrings->id = $recordid;
|
||||
$newhotpotstrings->string = $result;
|
||||
update_record('hotpot_strings',$newhotpotstrings);
|
||||
/// And finally, just return the converted field
|
||||
$newhotpotstrings = new object;
|
||||
$newhotpotstrings->id = $recordid;
|
||||
$newhotpotstrings->string = $result;
|
||||
update_record('hotpot_strings',$newhotpotstrings);
|
||||
/// And finally, just return the converted field
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
function migrate2utf8_hotpot_questions_name($recordid){
|
||||
global $CFG;
|
||||
global $CFG, $globallang;
|
||||
|
||||
/// Some trivial checks
|
||||
if (empty($recordid)) {
|
||||
|
@ -56,28 +62,33 @@ function migrate2utf8_hotpot_questions_name($recordid){
|
|||
log_the_problem_somewhere();
|
||||
return false;
|
||||
}
|
||||
if ($globallang) {
|
||||
$fromenc = $globallang;
|
||||
} else {
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($hotpot->course); //Non existing!
|
||||
$userlang = get_main_teacher_lang($hotpot->course); //N.E.!!
|
||||
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($hotpot->course); //Non existing!
|
||||
$userlang = get_main_teacher_lang($hotpot->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($hotpotquestion->name, $fromenc);
|
||||
if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
|
||||
$result = utfconvert($hotpotquestion->name, $fromenc);
|
||||
|
||||
$newhotpotquestion = new object;
|
||||
$newhotpotquestion->id = $recordid;
|
||||
$newhotpotquestion->name = $result;
|
||||
update_record('hotpot_questions',$newhotpotquestion);
|
||||
/// And finally, just return the converted field
|
||||
$newhotpotquestion = new object;
|
||||
$newhotpotquestion->id = $recordid;
|
||||
$newhotpotquestion->name = $result;
|
||||
update_record('hotpot_questions',$newhotpotquestion);
|
||||
/// And finally, just return the converted field
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
function migrate2utf8_hotpot_name($recordid){
|
||||
global $CFG;
|
||||
global $CFG, $globallang;
|
||||
|
||||
/// Some trivial checks
|
||||
if (empty($recordid)) {
|
||||
|
@ -89,28 +100,33 @@ function migrate2utf8_hotpot_name($recordid){
|
|||
log_the_problem_somewhere();
|
||||
return false;
|
||||
}
|
||||
if ($globallang) {
|
||||
$fromenc = $globallang;
|
||||
} else {
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($hotpot->course); //Non existing!
|
||||
$userlang = get_main_teacher_lang($hotpot->course); //N.E.!!
|
||||
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($hotpot->course); //Non existing!
|
||||
$userlang = get_main_teacher_lang($hotpot->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($hotpot->name, $fromenc);
|
||||
if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
|
||||
$result = utfconvert($hotpot->name, $fromenc);
|
||||
|
||||
$newhotpot = new object;
|
||||
$newhotpot->id = $recordid;
|
||||
$newhotpot->name = $result;
|
||||
update_record('hotpot',$newhotpot);
|
||||
$newhotpot = new object;
|
||||
$newhotpot->id = $recordid;
|
||||
$newhotpot->name = $result;
|
||||
update_record('hotpot',$newhotpot);
|
||||
/// And finally, just return the converted field
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
function migrate2utf8_hotpot_summary($recordid){
|
||||
global $CFG;
|
||||
global $CFG, $globallang;
|
||||
|
||||
/// Some trivial checks
|
||||
if (empty($recordid)) {
|
||||
|
@ -122,28 +138,33 @@ function migrate2utf8_hotpot_summary($recordid){
|
|||
log_the_problem_somewhere();
|
||||
return false;
|
||||
}
|
||||
if ($globallang) {
|
||||
$fromenc = $globallang;
|
||||
} else {
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($hotpot->course); //Non existing!
|
||||
$userlang = get_main_teacher_lang($hotpot->course); //N.E.!!
|
||||
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($hotpot->course); //Non existing!
|
||||
$userlang = get_main_teacher_lang($hotpot->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($hotpot->summary, $fromenc);
|
||||
if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
|
||||
$result = utfconvert($hotpot->summary, $fromenc);
|
||||
|
||||
$newhotpot = new object;
|
||||
$newhotpot->id = $recordid;
|
||||
$newhotpot->summary = $result;
|
||||
update_record('hotpot',$newhotpot);
|
||||
$newhotpot = new object;
|
||||
$newhotpot->id = $recordid;
|
||||
$newhotpot->summary = $result;
|
||||
update_record('hotpot',$newhotpot);
|
||||
}
|
||||
/// And finally, just return the converted field
|
||||
return $result;
|
||||
}
|
||||
|
||||
function migrate2utf8_hotpot_password($recordid){
|
||||
global $CFG;
|
||||
global $CFG, $globallang;
|
||||
|
||||
/// Some trivial checks
|
||||
if (empty($recordid)) {
|
||||
|
@ -155,22 +176,27 @@ function migrate2utf8_hotpot_password($recordid){
|
|||
log_the_problem_somewhere();
|
||||
return false;
|
||||
}
|
||||
if ($globallang) {
|
||||
$fromenc = $globallang;
|
||||
} else {
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($hotpot->course); //Non existing!
|
||||
$userlang = get_main_teacher_lang($hotpot->course); //N.E.!!
|
||||
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = get_course_lang($hotpot->course); //Non existing!
|
||||
$userlang = get_main_teacher_lang($hotpot->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($hotpot->password, $fromenc);
|
||||
if (($fromenc != 'utf-8') && ($fromenc != 'UTF-8')) {
|
||||
$result = utfconvert($hotpot->password, $fromenc);
|
||||
|
||||
$newhotpot = new object;
|
||||
$newhotpot->id = $recordid;
|
||||
$newhotpot->password = $result;
|
||||
update_record('hotpot',$newhotpot);
|
||||
$newhotpot = new object;
|
||||
$newhotpot->id = $recordid;
|
||||
$newhotpot->password = $result;
|
||||
update_record('hotpot',$newhotpot);
|
||||
}
|
||||
/// And finally, just return the converted field
|
||||
return $result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue