Reconcept cl_raw_sortkey as cl_sortkey_prefix
authorAryeh Gregor <simetrical@users.mediawiki.org>
Mon, 26 Jul 2010 19:27:13 +0000 (19:27 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Mon, 26 Jul 2010 19:27:13 +0000 (19:27 +0000)
commit022b7ba1406a4f402ff24c355288cb6ffd6eb82d
tree407f59f9a5802c7771f55b286a2c4c85e6b5ed36
parentf3a89bb4d0048756e9f7fb5765cf0d5c39db2943
Reconcept cl_raw_sortkey as cl_sortkey_prefix

In response to feedback by Phillipe Verdy on bug 164.  Now if a bunch of
pages have [[Category:Foo| ]], they'll sort amongst themselves according
to page name, instead of in basically random order as it is currently.
This also makes storage more elegant and intuitive: instead of giving
NULL a magic meaning when there's no custom sortkey specified, we just
store an empty string, since there's no prefix.

This means {{defaultsort:}} really now means {{defaultsortprefix:}},
which is slightly confusing, and a lot of code is now slightly
misleading or poorly named.  But it should all work fine.

Also, while I was at it, I made updateCollation.php work as a transition
script, so you can apply the SQL patch and then run updateCollation.php
and things will work.  However, with the new schema it's not trivial to
reverse this -- you'd have to recover the raw sort keys with some PHP.
Conversion goes at about a thousand rows a second for me, and seems to
be CPU-bound.  Could probably be optimized.

I also adjusted the transition script so it will fix rows with collation
versions *greater* than the current one, as well as less.  Thus if some
site wants to use their own collation, they can call it 137 or
something, and if they later want to switch back to MediaWiki stock
collation 7, it will work.

Also fixed a silly bug in updateCollation.php where it would say "1000
done" if it did nothing, and changed $res->numRows() >= self::BATCH_SIZE
to == so people don't wonder how it could be bigger (since it can't, I
hope).
includes/CategoryPage.php
includes/DefaultSettings.php
includes/LinksUpdate.php
includes/Title.php
includes/parser/Parser.php
languages/Language.php
maintenance/archives/patch-categorylinks-better-collation.sql
maintenance/updateCollation.php