Permalink
Browse files

MDL-36597 strip '_utf8' from all course.lang fields

  • Loading branch information...
1 parent 4c7e6ea commit b768c6f77a2bb97628d6f6ff4026f1e6e79824d1 @skodak skodak committed Dec 15, 2012
Showing with 15 additions and 1 deletion.
  1. +14 −0 lib/db/upgrade.php
  2. +1 −1 version.php
View
@@ -1517,5 +1517,19 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2012120300.01);
}
+ if ($oldversion < 2012120300.04) {
+ // Remove "_utf8" suffix from all langs in course table.
+ $langs = $DB->get_records_sql("SELECT DISTINCT lang FROM {course} WHERE lang LIKE ?", array('%_utf8'));
+
+ foreach ($langs as $lang=>$unused) {
+ $newlang = str_replace('_utf8', '', $lang);
+ $sql = "UPDATE {course} SET lang = :newlang WHERE lang = :lang";
+ $DB->execute($sql, array('newlang'=>$newlang, 'lang'=>$lang));
+ }
+
+ // Main savepoint reached.
+ upgrade_main_savepoint(true, 2012120300.04);
+ }
+
return true;
}
View
@@ -30,7 +30,7 @@
defined('MOODLE_INTERNAL') || die();
-$version = 2012120300.03; // 20121203 = branching date YYYYMMDD - do not modify!
+$version = 2012120300.04; // 20121203 = branching date YYYYMMDD - do not modify!
// RR = release increments - 00 in DEV branches
// .XX = incremental changes

0 comments on commit b768c6f

Please sign in to comment.