Index: trunk/phase3/maintenance/archives/patch-categorylinks-better-collation.sql |
— | — | @@ -4,6 +4,10 @@ |
5 | 5 | -- Bugs 164, 1211, 23682. This is the second version of this patch; the |
6 | 6 | -- changes are also incorporated into patch-categorylinks-better-collation2.sql, |
7 | 7 | -- for the benefit of trunk users who applied the original. |
| 8 | +-- |
| 9 | +-- Due to bug 25254, the length limit of 255 bytes for cl_sortkey_prefix |
| 10 | +-- is also enforced in php. If you change the length of that field, make |
| 11 | +-- sure to also change the check in LinksUpdate.php. |
8 | 12 | ALTER TABLE /*$wgDBprefix*/categorylinks |
9 | 13 | CHANGE COLUMN cl_sortkey cl_sortkey varbinary(230) NOT NULL default '', |
10 | 14 | ADD COLUMN cl_sortkey_prefix varchar(255) binary NOT NULL default '', |
Index: trunk/phase3/includes/LinksUpdate.php |
— | — | @@ -67,6 +67,14 @@ |
68 | 68 | $this->mInterlangs[$key] = $title; |
69 | 69 | } |
70 | 70 | |
| 71 | + foreach ( $this->mCategories as $cat => &$sortkey ) { |
| 72 | + # If the sortkey is longer then 255 bytes, |
| 73 | + # it truncated by DB, and then doesn't get |
| 74 | + # matched when comparing existing vs current |
| 75 | + # categories, causing bug 25254. |
| 76 | + $sortkey = substr( $sortkey, 0, 255 ); |
| 77 | + } |
| 78 | + |
71 | 79 | $this->mRecursive = $recursive; |
72 | 80 | |
73 | 81 | wfRunHooks( 'LinksUpdateConstructed', array( &$this ) ); |
— | — | @@ -687,11 +695,15 @@ |
688 | 696 | * @private |
689 | 697 | */ |
690 | 698 | function getExistingCategories() { |
691 | | - $res = $this->mDb->select( 'categorylinks', array( 'cl_to', 'cl_sortkey' ), |
| 699 | + $res = $this->mDb->select( 'categorylinks', array( 'cl_to', 'cl_sortkey_prefix' ), |
692 | 700 | array( 'cl_from' => $this->mId ), __METHOD__, $this->mOptions ); |
693 | 701 | $arr = array(); |
694 | 702 | foreach ( $res as $row ) { |
695 | | - $arr[$row->cl_to] = $row->cl_sortkey; |
| 703 | + if ( $row->cl_sortkey_prefix !== '' ) { |
| 704 | + $arr[$row->cl_to] = $row->cl_sortkey_prefix; |
| 705 | + } else { |
| 706 | + $arr[$row->cl_to] = $this->mTitle->getCategorySortkey(); |
| 707 | + } |
696 | 708 | } |
697 | 709 | return $arr; |
698 | 710 | } |