logging table encoding fix -- hopefully it actually works, as I haven't seen feedback...
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 18 Feb 2005 10:55:58 +0000 (10:55 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 18 Feb 2005 10:55:58 +0000 (10:55 +0000)
maintenance/tables.sql
maintenance/updaters.inc

index 1935fcc..6e615bc 100644 (file)
@@ -328,7 +328,7 @@ CREATE TABLE /*$wgDBprefix*/logging (
   -- Key to the page affected. Where a user is the target,
   -- this will point to the user page.
   log_namespace tinyint unsigned NOT NULL default 0,
-  log_title varchar(255) NOT NULL default '',
+  log_title varchar(255) binary NOT NULL default '',
   
   -- Freeform text. Interpreted as edit history comments.
   log_comment varchar(255) NOT NULL default '',
index 58eb0cc..4d0c9d5 100644 (file)
@@ -248,6 +248,26 @@ function do_group_update() {
        }
 }
 
+/**
+ * 1.4 betas were missing the 'binary' marker from logging.log_title,
+ * which causes a collation mismatch error on joins in MySQL 4.1.
+ */
+function do_logging_encoding() {
+       global $wgDatabase;
+       $logging = $wgDatabase->tableName( 'logging' );
+       $res = $wgDatabase->query( "SELECT log_title FROM $logging LIMIT 0" );
+       $flags = explode( ' ', mysql_field_flags( $res, 0 ) );
+       $wgDatabase->freeResult( $res );
+       
+       if( in_array( 'binary', $flags ) ) {
+               echo "Logging table has correct title encoding.\n";
+       } else {
+               echo "Fixing title encoding on logging table... ";
+               dbsource( 'maintenance/archives/patch-logging-title.sql', $wgDatabase );
+               echo "ok\n";
+       }
+}
+
 function do_schema_restructuring() {
        global $wgDatabase;
        $fname="do_schema_restructuring";
@@ -413,7 +433,8 @@ function do_all_updates() {
        do_watchlist_update(); flush();
        do_user_update(); flush();
        do_copy_newtalk_to_watchlist(); flush();
-
+       do_logging_encoding(); flush();
+       
        do_schema_restructuring(); flush();
 
        if ( isTemplateInitialised() ) {