- new field: page_key, stores page_title in uppercase.
authorRiver Tarnell <river@users.mediawiki.org>
Mon, 30 Jul 2007 01:56:37 +0000 (01:56 +0000)
committerRiver Tarnell <river@users.mediawiki.org>
Mon, 30 Jul 2007 01:56:37 +0000 (01:56 +0000)
  schema change, maintenance script included

includes/Article.php
includes/Title.php
maintenance/tables.sql
maintenance/updaters.inc

index 48422f5..2595299 100644 (file)
@@ -262,6 +262,7 @@ class Article {
                                'page_id',
                                'page_namespace',
                                'page_title',
+                               'page_key',
                                'page_restrictions',
                                'page_counter',
                                'page_is_redirect',
@@ -1001,6 +1002,7 @@ class Article {
         * @private
         */
        function insertOn( $dbw ) {
+               global $wgContLang;
                wfProfileIn( __METHOD__ );
 
                $page_id = $dbw->nextSequenceValue( 'page_page_id_seq' );
@@ -1008,6 +1010,7 @@ class Article {
                        'page_id'           => $page_id,
                        'page_namespace'    => $this->mTitle->getNamespace(),
                        'page_title'        => $this->mTitle->getDBkey(),
+                       'page_key'          => $wgContLang->caseFold($this->mTitle->getDBkey()),
                        'page_counter'      => 0,
                        'page_restrictions' => '',
                        'page_is_redirect'  => 0, # Will set this shortly...
index 7a459bd..338fc0f 100644 (file)
@@ -2126,7 +2126,7 @@ class Title {
         *      be a redirect
         */
        private function moveOverExistingRedirect( &$nt, $reason = '' ) {
-               global $wgUseSquid;
+               global $wgUseSquid, $wgContLang;
                $fname = 'Title::moveOverExistingRedirect';
                $comment = wfMsgForContent( '1movedto2_redir', $this->getPrefixedText(), $nt->getPrefixedText() );
 
@@ -2156,6 +2156,7 @@ class Title {
                                'page_touched'   => $dbw->timestamp($now),
                                'page_namespace' => $nt->getNamespace(),
                                'page_title'     => $nt->getDBkey(),
+                               'page_key'       => $wgContLang->caseFold($nt->getDBkey()),
                                'page_latest'    => $nullRevId,
                        ),
                        /* WHERE */ array( 'page_id' => $oldid ),
@@ -2203,7 +2204,7 @@ class Title {
         * @param Title &$nt the new Title
         */
        private function moveToNewTitle( &$nt, $reason = '' ) {
-               global $wgUseSquid;
+               global $wgUseSquid, $wgContLang;
                $fname = 'MovePageForm::moveToNewTitle';
                $comment = wfMsgForContent( '1movedto2', $this->getPrefixedText(), $nt->getPrefixedText() );
                if ( $reason ) {
@@ -2226,6 +2227,7 @@ class Title {
                                'page_touched'   => $now,
                                'page_namespace' => $nt->getNamespace(),
                                'page_title'     => $nt->getDBkey(),
+                               'page_key'       => $wgContLang->caseFold($nt->getDBkey()),
                                'page_latest'    => $nullRevId,
                        ),
                        /* WHERE */ array( 'page_id' => $oldid ),
index e9d6afb..fb4ac46 100644 (file)
@@ -190,6 +190,9 @@ CREATE TABLE /*$wgDBprefix*/page (
   -- Spaces are transformed into underscores in title storage.
   page_title varchar(255) binary NOT NULL,
   
+  -- page_title in uppercase.  Used for case-insensitive title searching.
+  page_key varchar(255) binary NOT NULL,
+
   -- Comma-separated set of permission keys indicating who
   -- can move or edit the page.
   page_restrictions tinyblob NOT NULL,
index 2b04740..9391fc2 100644 (file)
@@ -82,6 +82,7 @@ $wgNewFields = array(
        array( 'oldimage',      'oi_metadata',      'patch-oi_metadata.sql'),
        array( 'archive',       'ar_page',          'patch-archive-ar_page.sql'),
        array( 'image',         'img_sha1',         'patch-img_sha1.sql' ),
+       array( 'page',          'page_key',         'patch-page_key.sql' ),
 );
 
 # For extensions only, should be populated via hooks