]> git.mjollnir.org Git - moodle.git/commitdiff
fix for 5205
authortoyomoyo <toyomoyo>
Mon, 24 Apr 2006 02:20:06 +0000 (02:20 +0000)
committertoyomoyo <toyomoyo>
Mon, 24 Apr 2006 02:20:06 +0000 (02:20 +0000)
admin/utfdbmigrate.php
backup/db/mysql.php
version.php

index e91cb76d11d678d029d0c58d7b6136735252ca43..32678ab2b6ac701b913c2e5f6dd7a51673119c0c 100755 (executable)
@@ -349,16 +349,22 @@ function db_migrate2utf8(){   //Eloy: Perhaps some type of limit parameter here
 
 
                     if ($CFG->dbtype == 'mysql') {
+
+                        /* Drop the index, because with index on, you can't change it to longblob */
+
                         if ($dropindex){    //drop index if index is varchar, text etc type
                             $SQL = 'ALTER TABLE '.$CFG->prefix.$dbtablename.' DROP INDEX '.$dropindex.';';
+                            $SQL1 = 'ALTER TABLE '.$CFG->prefix.$dbtablename.' DROP INDEX '.$CFG->prefix.$dropindex.';'; // see bug 5205
                             if ($debug) {
                                 $db->debug=999;
                             }
-                            execute_sql($SQL, $debug);
+                            execute_sql($SQL, false); // see bug 5205
+                            execute_sql($SQL1, false); // see bug 5205
+
                             if ($debug) {
                                 $db->debug=0;
                             }
-                        } else if ($dropprimary) {    //drop primary key
+                        } else if ($dropprimary) {    // drop primary key
                             $SQL = 'ALTER TABLE '.$CFG->prefix.$dbtablename.' DROP PRIMARY KEY;';
                             if ($debug) {
                                 $db->debug=999;
@@ -369,9 +375,13 @@ function db_migrate2utf8(){   //Eloy: Perhaps some type of limit parameter here
                             }
                         }
 
-                        /*********************************
-                         * Change column encoding 2 phase*
-                         *********************************/
+                        /* Change to longblob, serves 2 purposes:
+                           1. column loses encoding, so when we finally change it to unicode,
+                              mysql does not do a double convertion
+                           2. longblobs puts no limit (ok, not really but it's large enough)
+                              to handle most of the problems such as in bug 5194
+                        */
+                           
                         $SQL = 'ALTER TABLE '.$CFG->prefix.$dbtablename;
                         $SQL.= ' CHANGE '.$fieldname.' '.$fieldname.' LONGBLOB';
 
@@ -393,10 +403,6 @@ function db_migrate2utf8(){   //Eloy: Perhaps some type of limit parameter here
                         
                     }
 
-
-
-
-
                     $patterns[]='/RECORDID/';    //for preg_replace
                     $patterns[]='/\{\$CFG\-\>prefix\}/i';    //same here
 
index 134fb9a6f641149bef91222d3db6d623378aeb41..faffb5b587e8820d01bc581b449d1c2da415c7d0 100644 (file)
@@ -138,8 +138,11 @@ function backup_upgrade($oldversion=0) {
 
     // code to drop the prefix in tables
     if ($oldversion < 2006042100) {
-        $result = execute_sql("ALTER TABLE {$CFG->prefix}backup_files DROP INDEX backup_files_uk");
-        $result = execute_sql("ALTER TABLE {$CFG->prefix}backup_ids DROP INDEX backup_ids_uk");
+        // see bug 5205, silent drops, so should not panic anyone
+        $result = execute_sql("ALTER TABLE {$CFG->prefix}backup_files DROP INDEX backup_files_uk", false);
+        $result = execute_sql("ALTER TABLE {$CFG->prefix}backup_files DROP INDEX {$CFG->prefix}backup_files_uk", false);
+        $result = execute_sql("ALTER TABLE {$CFG->prefix}backup_ids DROP INDEX backup_ids_uk", false);
+        $result = execute_sql("ALTER TABLE {$CFG->prefix}backup_ids DROP INDEX {$CFG->prefix}backup_ids_uk", false);
         $result = execute_sql("ALTER TABLE {$CFG->prefix}backup_files ADD UNIQUE INDEX backup_files_uk(backup_code,file_type(10),path(255))");
         $result = execute_sql("ALTER TABLE {$CFG->prefix}backup_ids ADD UNIQUE INDEX backup_ids_uk(backup_code,table_name(30),old_id)");
     }
index b0bbe665c4214d7f32a3041556f5abfa00731dc0..f47720e081a2ed2ed7743ad6ffa93a413a89ade5 100644 (file)
@@ -6,7 +6,7 @@
 // This is compared against the values stored in the database to determine
 // whether upgrades should be performed (see lib/db/*.php)
 
-   $version = 2006041900;  // YYYYMMDD = date
+   $version = 2006042400;  // YYYYMMDD = date
                            //       XY = increments within a single day
 
    $release = '1.6 Beta 3';    // Human-friendly version name