mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 04:52:36 +02:00
NO_CONV for backup_log_info
This commit is contained in:
parent
ed2482dfae
commit
4c64486f0c
@ -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;
|
||||
|
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user