From c79b4bdd2193a4c6e5fda877850bcc98add51e82 Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Mon, 17 Jan 2011 06:27:49 +0000 Subject: [PATCH] Change the default collation from strtoupper to Language::uc, so that non-ascii characters get to play too. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit I know the uppercase thing is just a standby until a real collation function is written. However in the mean time, i think it'd be really weird for a wiki with $wgCapitalLinks = false to suddenly have [[a]] and [[A]] sort under the same letter in a category page, but [[Ä]] and [[ä]] sort no where near each other, even though on a capitalized wiki they would be the same page. See discussion on r69816. Also fix an issue with maintenance/updateCollation.php, where php thinks that 'uppercase' == 0 (?!). I don't really know what the deal with that is, but using a ! instead of == 0 seems to fix it. (Follow-up r69961) --- includes/DefaultSettings.php | 4 ++-- languages/Language.php | 4 ++-- maintenance/updateCollation.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 43d5150588..18044e91ad 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -4616,10 +4616,10 @@ $wgCategoryPagingLimit = 200; * for all rows where cl_collation != $wgCategoryCollation and regenerates * cl_sortkey based on the page name and cl_sortkey_prefix. * - * Currently only supports 'uppercase', which just uppercases the string. This + * Currently only supports 'uppercase2', which just uppercases the string. This * is a dummy collation, to be replaced later by real ones. */ -$wgCategoryCollation = 'uppercase'; +$wgCategoryCollation = 'uppercase2'; /** @} */ # End categories } diff --git a/languages/Language.php b/languages/Language.php index 62a2b11954..1d3528fac5 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -3010,7 +3010,7 @@ class Language { */ public function convertToSortkey( $string ) { # Fake function for now - return strtoupper( $string ); + return $this->uc( $string ); } /** @@ -3040,6 +3040,6 @@ class Language { if ( $string[0] == "\0" ) { $string = substr( $string, 1 ); } - return strtoupper( $this->firstChar( $string ) ); + return $this->uc( $this->firstChar( $string ) ); } } diff --git a/maintenance/updateCollation.php b/maintenance/updateCollation.php index 67b6b1002a..9e8dd3306e 100644 --- a/maintenance/updateCollation.php +++ b/maintenance/updateCollation.php @@ -80,7 +80,7 @@ TEXT; $dbw->begin(); foreach ( $res as $row ) { $title = Title::newFromRow( $row ); - if ( $row->cl_collation == 0 ) { + if ( !$row->cl_collation ) { # This is an old-style row, so the sortkey needs to be # converted. if ( $row->cl_sortkey == $title->getText() -- 2.20.1