From 9a7f3cad99750f1daf603d3bceef4bd6aa4d1590 Mon Sep 17 00:00:00 2001 From: toyomoyo Date: Mon, 24 Apr 2006 02:20:06 +0000 Subject: [PATCH] fix for 5205 --- admin/utfdbmigrate.php | 24 +++++++++++++++--------- backup/db/mysql.php | 7 +++++-- version.php | 2 +- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/admin/utfdbmigrate.php b/admin/utfdbmigrate.php index e91cb76d11..32678ab2b6 100755 --- a/admin/utfdbmigrate.php +++ b/admin/utfdbmigrate.php @@ -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 diff --git a/backup/db/mysql.php b/backup/db/mysql.php index 134fb9a6f6..faffb5b587 100644 --- a/backup/db/mysql.php +++ b/backup/db/mysql.php @@ -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)"); } diff --git a/version.php b/version.php index b0bbe665c4..f47720e081 100644 --- a/version.php +++ b/version.php @@ -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 -- 2.39.5