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

Revision: 100315
Author:   aaron
Date:     2011-10-20 01:15:28 +0000 (Thu, 20 Oct 2011)
Log Message:
-----------
* Made ?contribs=user actually show the results for the *user* if 'newbies' was 
given as the user.
* Added a link batch query to newbie contribs paging

Modified Paths:
--------------
    trunk/phase3/includes/specials/SpecialContributions.php

Modified: trunk/phase3/includes/specials/SpecialContributions.php
===================================================================
--- trunk/phase3/includes/specials/SpecialContributions.php     2011-10-20 
01:05:52 UTC (rev 100314)
+++ trunk/phase3/includes/specials/SpecialContributions.php     2011-10-20 
01:15:28 UTC (rev 100315)
@@ -57,6 +57,8 @@
                if( $request->getVal( 'contribs' ) == 'newbie' ) {
                        $target = 'newbies';
                        $this->opts['contribs'] = 'newbie';
+               } else {
+                       $this->opts['contribs'] = 'user';
                }
 
                $this->opts['deletedOnly'] = $request->getBool( 'deletedOnly' );
@@ -79,7 +81,7 @@
                }
                $id = User::idFromName( $nt->getText() );
 
-               if( $target != 'newbies' ) {
+               if( $this->opts['contribs'] != 'newbie' ) {
                        $target = $nt->getText();
                        $out->setSubtitle( $this->contributionsSub( $nt, $id ) 
);
                        $out->setHTMLTitle( wfMsg( 'pagetitle', wfMsgExt( 
'contributions-title', array( 'parsemag' ),$target ) ) );
@@ -159,6 +161,7 @@
 
                        $pager = new ContribsPager( array(
                                'target' => $target,
+                               'contribs' => $this->opts['contribs'],
                                'namespace' => $this->opts['namespace'],
                                'year' => $this->opts['year'],
                                'month' => $this->opts['month'],
@@ -182,7 +185,7 @@
                        $out->preventClickjacking( 
$pager->getPreventClickjacking() );
 
                        # Show the appropriate "footer" message - WHOIS tools, 
etc.
-                       if( $target != 'newbies' ) {
+                       if( $this->opts['contribs'] != 'newbie' ) {
                                $message = 'sp-contributions-footer';
                                if ( IP::isIPAddress( $target ) ) {
                                        $message = 
'sp-contributions-footer-anon';
@@ -439,6 +442,7 @@
                }
 
                $this->target = isset( $options['target'] ) ? 
$options['target'] : '';
+               $this->contribs = isset( $options['contribs'] ) ? 
$options['contribs'] : 'users';
                $this->namespace = isset( $options['namespace'] ) ? 
$options['namespace'] : '';
                $this->tagFilter = isset( $options['tagFilter'] ) ? 
$options['tagFilter'] : false;
 
@@ -506,7 +510,7 @@
                $condition = array();
                $join_conds = array();
                $tables = array( 'revision', 'page', 'user' );
-               if( $this->target == 'newbies' ) {
+               if( $this->contribs == 'newbie' ) {
                        $tables[] = 'user_groups';
                        $max = $this->mDb->selectField( 'user', 'max(user_id)', 
false, __METHOD__ );
                        $condition[] = 'rev_user >' . (int)($max - $max / 100);
@@ -544,6 +548,21 @@
                return 'rev_timestamp';
        }
 
+       function doBatchLookups() {
+               if ( $this->contribs === 'newbie' ) { // multiple users
+                       # Do a link batch query
+                       $this->mResult->seek( 0 );
+                       $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->execute();
+                       $this->mResult->seek( 0 );
+               }
+       }
+
        function getStartBody() {
                return "<ul>\n";
        }
@@ -672,7 +691,7 @@
 
                # Show user names for /newbies as there may be different users.
                # Note that we already excluded rows with hidden user names.
-               if( $this->target == 'newbies' ) {
+               if( $this->contribs == 'newbie' ) {
                        $userlink = ' . . ' . Linker::userLink( 
$rev->getUser(), $rev->getUserText() );
                        $userlink .= ' ' . wfMsg( 'parentheses',
                                Linker::userTalkLink( $rev->getUser(), 
$rev->getUserText() ) ) . ' ';


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to