http://www.mediawiki.org/wiki/Special:Code/MediaWiki/100326

Revision: 100326
Author:   aaron
Date:     2011-10-20 03:03:45 +0000 (Thu, 20 Oct 2011)
Log Message:
-----------
* Simplified r100286 by just using the field 'user_name' and removed the 
COALESCE
* Simplified contribs pager with Revision::selectFields()

Modified Paths:
--------------
    trunk/phase3/includes/HistoryPage.php
    trunk/phase3/includes/Revision.php
    trunk/phase3/includes/RevisionList.php
    trunk/phase3/includes/revisiondelete/RevisionDelete.php
    trunk/phase3/includes/specials/SpecialContributions.php
    trunk/phase3/includes/specials/SpecialMergeHistory.php

Modified: trunk/phase3/includes/HistoryPage.php
===================================================================
--- trunk/phase3/includes/HistoryPage.php       2011-10-20 02:26:59 UTC (rev 
100325)
+++ trunk/phase3/includes/HistoryPage.php       2011-10-20 03:03:45 UTC (rev 
100326)
@@ -388,8 +388,8 @@
                $batch = new LinkBatch();
                # Give some pointers to make (last) links
                foreach ( $this->mResult as $row ) {
-                       $batch->addObj( Title::makeTitleSafe( NS_USER, 
$row->rev_user_name ) );
-                       $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, 
$row->rev_user_name ) );
+                       $batch->addObj( Title::makeTitleSafe( NS_USER, 
$row->user_name ) );
+                       $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, 
$row->user_name ) );
                }
                $batch->execute();
                $this->mResult->seek( 0 );

Modified: trunk/phase3/includes/Revision.php
===================================================================
--- trunk/phase3/includes/Revision.php  2011-10-20 02:26:59 UTC (rev 100325)
+++ trunk/phase3/includes/Revision.php  2011-10-20 03:03:45 UTC (rev 100326)
@@ -327,7 +327,7 @@
         * Return the list of user fields that should be selected from user 
table
         */
        public static function selectUserFields() {
-               return array( 'COALESCE(user_name,rev_user_text) AS 
rev_user_name' );
+               return array( 'user_name' );
        }
 
        /**
@@ -376,10 +376,12 @@
                                $this->mTextRow = null;
                        }
 
-                       if ( isset( $row->rev_user_name ) ) {
-                               $this->mUserText = $row->rev_user_name; // 
current user name
-                       } else { // fallback to rev_user_text
-                               $this->mUserText = $row->rev_user_text; // 
de-normalized
+                       // Use user_name for users and rev_user_text for IPs.
+                       // Also fallback to rev_user_text if user_name not 
given.
+                       if ( isset( $row->user_name ) ) {
+                               $this->mUserText = $row->user_name; // 
logged-in user (ideally)
+                       } else {
+                               $this->mUserText = $row->rev_user_text; // IP 
user (ideally)
                        }
                } elseif( is_array( $row ) ) {
                        // Build a new revision to be saved...

Modified: trunk/phase3/includes/RevisionList.php
===================================================================
--- trunk/phase3/includes/RevisionList.php      2011-10-20 02:26:59 UTC (rev 
100325)
+++ trunk/phase3/includes/RevisionList.php      2011-10-20 03:03:45 UTC (rev 
100326)
@@ -295,7 +295,7 @@
        }
 
        public function getAuthorNameField() {
-               return 'rev_user_name'; // see Revision::selectUserFields()
+               return 'user_name'; // see Revision::selectUserFields()
        }
 
        public function canView() {

Modified: trunk/phase3/includes/revisiondelete/RevisionDelete.php
===================================================================
--- trunk/phase3/includes/revisiondelete/RevisionDelete.php     2011-10-20 
02:26:59 UTC (rev 100325)
+++ trunk/phase3/includes/revisiondelete/RevisionDelete.php     2011-10-20 
03:03:45 UTC (rev 100326)
@@ -131,7 +131,7 @@
        }
 
        public function getAuthorNameField() {
-               return 'rev_user_name'; // see Revision::selectUserFields()
+               return 'user_name'; // see Revision::selectUserFields()
        }
 
        public function canView() {

Modified: trunk/phase3/includes/specials/SpecialContributions.php
===================================================================
--- trunk/phase3/includes/specials/SpecialContributions.php     2011-10-20 
02:26:59 UTC (rev 100325)
+++ trunk/phase3/includes/specials/SpecialContributions.php     2011-10-20 
03:03:45 UTC (rev 100326)
@@ -481,15 +481,15 @@
                $join_cond['user'] = array( 'LEFT JOIN', 'rev_user != 0 AND 
user_id = rev_user' );
 
                $queryInfo = array(
-                       'tables' => $tables,
-                       'fields' => array_merge( Revision::selectUserFields(), 
array(
-                               'page_namespace', 'page_title', 'page_is_new', 
'page_latest', 'page_is_redirect',
-                               'page_len', 'rev_id', 'rev_page', 
'rev_text_id', 'rev_timestamp', 'rev_comment',
-                               'rev_minor_edit', 'rev_user', 'rev_user_text', 
'rev_parent_id', 'rev_deleted',
-                               'rev_len'
-                       ) ),
-                       'conds' => $conds,
-                       'options' => array( 'USE INDEX' => array('revision' => 
$index) ),
+                       'tables'     => $tables,
+                       'fields'     => array_merge(
+                               Revision::selectFields(),
+                               Revision::selectUserFields(),
+                               array( 'page_namespace', 'page_title', 
'page_is_new',
+                                       'page_latest', 'page_is_redirect', 
'page_len' )
+                       ),
+                       'conds'      => $conds,
+                       'options'    => array( 'USE INDEX' => array( 'revision' 
=> $index ) ),
                        'join_conds' => $join_cond
                );
 
@@ -567,8 +567,8 @@
                        $batch = new LinkBatch();
                        # Give some pointers to make (last) links
                        foreach ( $this->mResult as $row ) {
-                               $batch->addObj( Title::makeTitleSafe( NS_USER, 
$row->rev_user_name ) );
-                               $batch->addObj( Title::makeTitleSafe( 
NS_USER_TALK, $row->rev_user_name ) );
+                               $batch->addObj( Title::makeTitleSafe( NS_USER, 
$row->user_name ) );
+                               $batch->addObj( Title::makeTitleSafe( 
NS_USER_TALK, $row->user_name ) );
                        }
                        $batch->execute();
                        $this->mResult->seek( 0 );

Modified: trunk/phase3/includes/specials/SpecialMergeHistory.php
===================================================================
--- trunk/phase3/includes/specials/SpecialMergeHistory.php      2011-10-20 
02:26:59 UTC (rev 100325)
+++ trunk/phase3/includes/specials/SpecialMergeHistory.php      2011-10-20 
03:03:45 UTC (rev 100326)
@@ -452,8 +452,8 @@
                # Give some pointers to make (last) links
                $this->mForm->prevId = array();
                foreach ( $this->mResult as $row ) {
-                       $batch->addObj( Title::makeTitleSafe( NS_USER, 
$row->rev_user_name ) );
-                       $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, 
$row->rev_user_name ) );
+                       $batch->addObj( Title::makeTitleSafe( NS_USER, 
$row->user_name ) );
+                       $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, 
$row->user_name ) );
 
                        $rev_id = isset( $rev_id ) ? $rev_id : $row->rev_id;
                        if( $rev_id > $row->rev_id ) {


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to