r81313 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81312‎ | r81313 | r81314 >
Date:18:58, 1 February 2011
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
Followup r81311, add MysqlUpdater function to update ll_lang length if it's still 10
Modified paths:
  • /trunk/phase3/includes/installer/MysqlUpdater.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/MysqlUpdater.php
@@ -173,6 +173,7 @@
174174 array( 'addTable', 'module_deps', 'patch-module_deps.sql' ),
175175 array( 'dropIndex', 'archive', 'ar_page_revid', 'patch-archive_kill_ar_page_revid.sql' ),
176176 array( 'addIndex', 'archive', 'ar_revid', 'patch-archive_ar_revid.sql' ),
 177+ array( 'doLangLinksLengthUpdate' ),
177178 );
178179 }
179180
@@ -813,4 +814,18 @@
814815 $this->applyPatch( 'patch-categorylinks-better-collation2.sql' );
815816 $this->output( "done.\n" );
816817 }
 818+
 819+ protected function doLangLinksLengthUpdate() {
 820+ $langlinks = $this->db->tableName( 'langlinks' );
 821+ $res = $this->db->query( "SHOW COLUMNS FROM $langlinks LIKE 'll_lang'" );
 822+ $row = $this->db->fetchObject( $res );
 823+
 824+ if ( $row && $row->Type == "varbinary(210)" ) {
 825+ $this->output( 'Updating length of ll_lang in langlinks...' );
 826+ $this->applyPatch( 'patch-langlinks-ll_lang-20.sql' );
 827+ $this->output( "done.\n" );
 828+ } else {
 829+ $this->output( "...ll_lang is up-to-date.\n" );
 830+ }
 831+ }
817832 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r81399Followup r81313, fix 210 typoreedy15:48, 2 February 2011
r814131.17: MFT r78395, r79968, r81311, r81313, r81349, r81352, r81376, r81389, r81...catrope20:45, 2 February 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r81311For bug 24129 and a followup to r23239, there was never a patch to transfer f...reedy18:35, 1 February 2011

Comments

#Comment by Catrope (talk | contribs)   15:01, 2 February 2011
+		if ( $row && $row->Type == "varbinary(210)" ) {

I assume this is a typo for varbinary(10)?

#Comment by 😂 (talk | contribs)   15:09, 2 February 2011

Why didn't you just use getFieldInfo()->getLength()?

#Comment by Reedy (talk | contribs)   15:50, 2 February 2011

Typo fixed in followup.

As for "getLength", as per IRC, see below:


reedy@ubuntu64-esxi:~/mediawiki/trunk/phase3/maintenance$ php eval.php
> $db = wfGetDb( DB_SLAVE );

> $fi = $db->fieldInfo( 'langlinks', 'll_lang');

> var_dump( $fi );
object(MySQLField)#17 (10) {
  ["name":"MySQLField":private]=>
  string(7) "ll_lang"
  ["tablename":"MySQLField":private]=>
  string(12) "mw_langlinks"
  ["default":"MySQLField":private]=>
  string(0) ""
  ["max_length":"MySQLField":private]=>
  int(0)
  ["nullable":"MySQLField":private]=>
  bool(false)
  ["is_pk":"MySQLField":private]=>
  int(1)
  ["is_unique":"MySQLField":private]=>
  int(0)
  ["is_multiple":"MySQLField":private]=>
  int(1)
  ["is_key":"MySQLField":private]=>
  bool(true)
  ["type":"MySQLField":private]=>
  string(6) "string"
}

We get "max_length", which is 0, so it's no use to me :(


<^demon> Reedy: mysql_fetch_field() sucks, it seems :)

Status & tagging log