Case-sensitive MediaWiki

I just finished setting up a MediaWiki for WorldIRC. Page titles and user names should be fully case-sensitive (i.e., able to start with a lowercase letter). Unfortunately, MediaWiki doesn’t really support that out of the box. Googling didn’t yield any usable results. Finally, asking in the IRC channels got me on the right track: In your LocalSettings.php, add at the end:

$wgCapitalLinks = false;

To get case-sensitive usernames, but still allow case-insensitive logins, you need to patch the code.
Here’s my patch against the current stable 1.6 version (r14760):

Index: includes/User.php
===================================================================
--- includes/User.php   (revision 14760)
+++ includes/User.php   (working copy)
@@ -51,9 +51,11 @@
   * @static
   */
  function newFromName( $name ) {
+   /* don't
    # Force usernames to capital
    global $wgContLang;
    $name = $wgContLang->ucfirst( $name );
+   */

    # Clean up name according to title rules
    $t = Title::newFromText( $name );
@@ -148,7 +150,7 @@
      return null;
    }
    $dbr =& wfGetDB( DB_SLAVE );
-   $s = $dbr->selectRow( 'user', array( 'user_id' ), array( 'user_name' => $nt->getText() ), $fname );
+   $s = $dbr->selectRow( 'user', array( 'user_id' ), 'LCASE(user_name) = LCASE(' . $dbr->addQuotes( $nt->getText() ) . ')', $fname );

    if ( $s === false ) {
      return 0;
@@ -200,7 +202,7 @@
    || User::isIP( $name )
    || strpos( $name, '/' ) !== false
    || strlen( $name ) > $wgMaxNameChars
-   || $name != $wgContLang->ucfirst( $name ) )
+   /* || $name != $wgContLang->ucfirst( $name ) */ )
      return false;

    // Ensure that the name can't be misresolved as a different title,

Thanks to Pill- and spacebirdy of #wiktionary and PhilHarnish and Nikerabbit of #mediawiki!