NO_CONV for backup_log_info

This commit is contained in:
toyomoyo 2006-03-02 01:33:00 +00:00
parent ed2482dfae
commit 4c64486f0c
2 changed files with 1 additions and 44 deletions

View File

@ -1,43 +1,4 @@
<?
function migrate2utf8_backup_log_info($recordid){
global $CFG, $globallang;
/// Some trivial checks
if (empty($recordid)) {
log_the_problem_somewhere();
return false;
}
if (!$backuplog = get_record('backup_log', 'id', $recordid)) {
log_the_problem_somewhere();
return false;
}
if ($globallang) {
$fromenc = $globallang;
} else {
$sitelang = $CFG->lang;
$courselang = get_course_lang($backuplog->courseid); //Non existing!
$userlang = get_main_teacher_lang($backuplog->courseid); //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($backuplog->info, $fromenc);
$newbackuplog = new object;
$newbackuplog->id = $recordid;
$newbackuplog->info = $result;
update_record('backup_log',$newbackuplog);
}
/// And finally, just return the converted field
return $result;
}
function migrate2utf8_backup_ids_info($recordid){
global $CFG, $globallang;

View File

@ -29,11 +29,7 @@
</TABLE>
<TABLE name="backup_log">
<FIELDS>
<FIELD name="info" method="PHP_FUNCTION" type="varchar" length="255">
<PHP_FUNCTION>
migrate2utf8_backup_log_info(RECORDID)
</PHP_FUNCTION>
</FIELD>
<FIELD name="info" method="NO_CONV" type="varchar" length="255" />
</FIELDS>
</TABLE>
</TABLES>