bug fixes
This commit is contained in:
@@ -1290,11 +1290,12 @@ function migrate2utf8_course_lang($recordid){
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strstr($course->lang,'utf8')===false){
|
||||
if (strstr($course->lang,'utf8')===false and !empty($course->lang)){
|
||||
$course->lang = $course->lang.'_utf8';
|
||||
}
|
||||
|
||||
update_record('course',$course);
|
||||
rebuild_course_cache($recordid); //takes care of serialized modinfo
|
||||
/// And finally, just return the converted field
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,39 @@
|
||||
<?
|
||||
function migrate2utf_hotpot_questions_name($recordid){
|
||||
|
||||
function migrate2utf8_hotpot_strings_string($recordid){
|
||||
global $CFG;
|
||||
|
||||
/// Some trivial checks
|
||||
if (empty($recordid)) {
|
||||
log_the_problem_somewhere();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$hotpotstrings = get_record('hotpot_strings','id',$recordid)) {
|
||||
log_the_problem_somewhere();
|
||||
return false;
|
||||
}
|
||||
|
||||
$sitelang = $CFG->lang;
|
||||
$courselang = null; //Non existing!
|
||||
$userlang = null; //N.E.!!
|
||||
|
||||
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
|
||||
|
||||
/// We are going to use textlib facilities
|
||||
$textlib = textlib_get_instance();
|
||||
/// Convert the text
|
||||
$result = $textlib->convert($hotpotstrings->string, $fromenc);
|
||||
|
||||
$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;
|
||||
|
||||
/// Some trivial checks
|
||||
@@ -13,12 +47,12 @@ function migrate2utf_hotpot_questions_name($recordid){
|
||||
WHERE h.id = hq.hotpot
|
||||
AND hq.id = $recordid";
|
||||
|
||||
if (!$hotpot = get_record_sql($SQL) {
|
||||
if (!$hotpot = get_record_sql($SQL)) {
|
||||
log_the_problem_somewhere();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$hotpotquestion = get_record_sql('hotpot_questions','id',$recordid) {
|
||||
if (!$hotpotquestion = get_record('hotpot_questions','id',$recordid)) {
|
||||
log_the_problem_somewhere();
|
||||
return false;
|
||||
}
|
||||
@@ -28,7 +62,7 @@ function migrate2utf_hotpot_questions_name($recordid){
|
||||
$userlang = get_main_teacher_lang($hotpot->course); //N.E.!!
|
||||
|
||||
$fromenc = get_original_encoding($sitelang, $courselang, $userlang);
|
||||
|
||||
|
||||
/// We are going to use textlib facilities
|
||||
$textlib = textlib_get_instance();
|
||||
/// Convert the text
|
||||
@@ -42,7 +76,7 @@ function migrate2utf_hotpot_questions_name($recordid){
|
||||
return $result;
|
||||
}
|
||||
|
||||
function migrate2utf_hotpot_name($recordid){
|
||||
function migrate2utf8_hotpot_name($recordid){
|
||||
global $CFG;
|
||||
|
||||
/// Some trivial checks
|
||||
@@ -51,7 +85,7 @@ function migrate2utf_hotpot_name($recordid){
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$hotpot = get_record('hotpot','id',$recordid) {
|
||||
if (!$hotpot = get_record('hotpot','id',$recordid)) {
|
||||
log_the_problem_somewhere();
|
||||
return false;
|
||||
}
|
||||
@@ -75,7 +109,7 @@ function migrate2utf_hotpot_name($recordid){
|
||||
return $result;
|
||||
}
|
||||
|
||||
function migrate2utf_hotpot_summary($recordid){
|
||||
function migrate2utf8_hotpot_summary($recordid){
|
||||
global $CFG;
|
||||
|
||||
/// Some trivial checks
|
||||
@@ -84,7 +118,7 @@ function migrate2utf_hotpot_summary($recordid){
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$hotpot = get_record('hotpot','id',$recordid) {
|
||||
if (!$hotpot = get_record('hotpot','id',$recordid)) {
|
||||
log_the_problem_somewhere();
|
||||
return false;
|
||||
}
|
||||
@@ -92,7 +126,7 @@ function migrate2utf_hotpot_summary($recordid){
|
||||
$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);
|
||||
|
||||
/// We are going to use textlib facilities
|
||||
@@ -108,7 +142,7 @@ function migrate2utf_hotpot_summary($recordid){
|
||||
return $result;
|
||||
}
|
||||
|
||||
function migrate2utf_hotpot_password($recordid){
|
||||
function migrate2utf8_hotpot_password($recordid){
|
||||
global $CFG;
|
||||
|
||||
/// Some trivial checks
|
||||
@@ -117,7 +151,7 @@ function migrate2utf_hotpot_password($recordid){
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$hotpot = get_record('hotpot','id',$recordid) {
|
||||
if (!$hotpot = get_record('hotpot','id',$recordid)) {
|
||||
log_the_problem_somewhere();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
<TABLE name="hotpot_attempts" />
|
||||
<TABLE name="hotpot_strings">
|
||||
<FIELDS>
|
||||
<FIELD name="string" method="NO_CONV" type="TEXT" length="0" />
|
||||
<FIELD name="string" method="PHP_FUNCTION" type="TEXT" length="0">
|
||||
<PHP_FUNCTION>
|
||||
migrate2utf8_hotpot_strings_string(RECORDID)
|
||||
</PHP_FUNCTION>
|
||||
</FIELD>
|
||||
</FIELDS>
|
||||
</TABLE>
|
||||
<TABLE name="hotpot_responses">
|
||||
@@ -46,18 +50,18 @@
|
||||
</TABLE>
|
||||
<TABLE name="hotpot">
|
||||
<FIELDS>
|
||||
<FIELD name="name" method="PLAIN_SQL_UPDATE" type="varchar" length="255">
|
||||
<FIELD name="name" method="PHP_FUNCTION" type="varchar" length="255">
|
||||
<PHP_FUNCTION>
|
||||
migrate2utf8_hotpot_name(RECORDID)
|
||||
</PHP_FUNCTION>
|
||||
</FIELD>
|
||||
<FIELD name="reference" method="NO_CONV" type="varchar" length="255" />
|
||||
<FIELD name="summary" method="PLAIN_SQL_UPDATE" type="text" length="0">
|
||||
<FIELD name="summary" method="PHP_FUNCTION" type="text" length="0">
|
||||
<PHP_FUNCTION>
|
||||
migrate2utf8_hotpot_summary(RECORDID)
|
||||
</PHP_FUNCTION>
|
||||
</FIELD>
|
||||
<FIELD name="password" method="PLAIN_SQL_UPDATE" type="varchar" length="255">
|
||||
<FIELD name="password" method="PHP_FUNCTION" type="varchar" length="255">
|
||||
<PHP_FUNCTION>
|
||||
migrate2utf8_hotpot_password(RECORDID)
|
||||
</PHP_FUNCTION>
|
||||
|
||||
Reference in New Issue
Block a user