r100315 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100314‎ | r100315 | r100316 >
Date:01:15, 20 October 2011
Author:aaron
Status:resolved (Comments)
Tags:
Comment:
* 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) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialContributions.php
@@ -57,6 +57,8 @@
5858 if( $request->getVal( 'contribs' ) == 'newbie' ) {
5959 $target = 'newbies';
6060 $this->opts['contribs'] = 'newbie';
 61+ } else {
 62+ $this->opts['contribs'] = 'user';
6163 }
6264
6365 $this->opts['deletedOnly'] = $request->getBool( 'deletedOnly' );
@@ -79,7 +81,7 @@
8082 }
8183 $id = User::idFromName( $nt->getText() );
8284
83 - if( $target != 'newbies' ) {
 85+ if( $this->opts['contribs'] != 'newbie' ) {
8486 $target = $nt->getText();
8587 $out->setSubtitle( $this->contributionsSub( $nt, $id ) );
8688 $out->setHTMLTitle( wfMsg( 'pagetitle', wfMsgExt( 'contributions-title', array( 'parsemag' ),$target ) ) );
@@ -159,6 +161,7 @@
160162
161163 $pager = new ContribsPager( array(
162164 'target' => $target,
 165+ 'contribs' => $this->opts['contribs'],
163166 'namespace' => $this->opts['namespace'],
164167 'year' => $this->opts['year'],
165168 'month' => $this->opts['month'],
@@ -182,7 +185,7 @@
183186 $out->preventClickjacking( $pager->getPreventClickjacking() );
184187
185188 # Show the appropriate "footer" message - WHOIS tools, etc.
186 - if( $target != 'newbies' ) {
 189+ if( $this->opts['contribs'] != 'newbie' ) {
187190 $message = 'sp-contributions-footer';
188191 if ( IP::isIPAddress( $target ) ) {
189192 $message = 'sp-contributions-footer-anon';
@@ -439,6 +442,7 @@
440443 }
441444
442445 $this->target = isset( $options['target'] ) ? $options['target'] : '';
 446+ $this->contribs = isset( $options['contribs'] ) ? $options['contribs'] : 'users';
443447 $this->namespace = isset( $options['namespace'] ) ? $options['namespace'] : '';
444448 $this->tagFilter = isset( $options['tagFilter'] ) ? $options['tagFilter'] : false;
445449
@@ -506,7 +510,7 @@
507511 $condition = array();
508512 $join_conds = array();
509513 $tables = array( 'revision', 'page', 'user' );
510 - if( $this->target == 'newbies' ) {
 514+ if( $this->contribs == 'newbie' ) {
511515 $tables[] = 'user_groups';
512516 $max = $this->mDb->selectField( 'user', 'max(user_id)', false, __METHOD__ );
513517 $condition[] = 'rev_user >' . (int)($max - $max / 100);
@@ -544,6 +548,21 @@
545549 return 'rev_timestamp';
546550 }
547551
 552+ function doBatchLookups() {
 553+ if ( $this->contribs === 'newbie' ) { // multiple users
 554+ # Do a link batch query
 555+ $this->mResult->seek( 0 );
 556+ $batch = new LinkBatch();
 557+ # Give some pointers to make (last) links
 558+ foreach ( $this->mResult as $row ) {
 559+ $batch->addObj( Title::makeTitleSafe( NS_USER, $row->rev_user_name ) );
 560+ $batch->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->rev_user_name ) );
 561+ }
 562+ $batch->execute();
 563+ $this->mResult->seek( 0 );
 564+ }
 565+ }
 566+
548567 function getStartBody() {
549568 return "<ul>\n";
550569 }
@@ -672,7 +691,7 @@
673692
674693 # Show user names for /newbies as there may be different users.
675694 # Note that we already excluded rows with hidden user names.
676 - if( $this->target == 'newbies' ) {
 695+ if( $this->contribs == 'newbie' ) {
677696 $userlink = ' . . ' . Linker::userLink( $rev->getUser(), $rev->getUserText() );
678697 $userlink .= ' ' . wfMsg( 'parentheses',
679698 Linker::userTalkLink( $rev->getUser(), $rev->getUserText() ) ) . ' ';

Follow-up revisions

RevisionCommit summaryAuthorDate
r110620Release notes for r100315aaron21:46, 2 February 2012
r112350r100315: removed now redundant codeaaron20:22, 24 February 2012

Comments

#Comment by Bawolff (talk | contribs)   04:46, 20 December 2011

This breaks links of the form Special:Contributions/newbies, which seem to be used at Wikipedia quite a bit.

#Comment by Aaron Schulz (talk | contribs)   06:17, 20 December 2011

You want to commit a patch banning the name 'newbies'? One or the other :)

#Comment by Bawolff (talk | contribs)   06:26, 20 December 2011

I wouldn't be opposed to that, although its certainly not ideal. I think its better to ban username newbies then it is to break all the existing links.

On the other hand, its only "newbies" with a lowercase n we have to care about, and we normalize all usernames to uppercase first (I believe) so we could make 'Newbies' be the username, and 'newbies' be the new folks contribs only one directly from 'subpage' and not from form submit. But special casing like that seems evil...

#Comment by Aaron Schulz (talk | contribs)   06:30, 20 December 2011

Really the whole 'newbies' thing was poorly thought out. It should have never been there, ideally it would have been a different special page. How hard is it to change the links?

#Comment by Bawolff (talk | contribs)   06:55, 20 December 2011

Hmm, I suppose in practise people would probably fix their links quite quickly once they realized it stopped working

#Comment by Johnduhart (talk | contribs)   17:37, 23 January 2012

After an angry post to foundation-l

#Comment by Reedy (talk | contribs)   17:33, 23 January 2012

Are we going to just accept this as a small casualty? Maybe we just remember to note it in the deployment notes for the communities?

#Comment by Aaron Schulz (talk | contribs)   18:16, 1 February 2012

Sounds fine to me.

#Comment by 😂 (talk | contribs)   14:10, 2 February 2012

+1. Somebody add the release notes and we'll call this resolved.

#Comment by 😂 (talk | contribs)   14:11, 2 February 2012

+1. Somebody add the release notes and we'll call this resolved.

#Comment by 😂 (talk | contribs)   14:12, 2 February 2012

+1. Somebody add the release notes and we'll call this resolved.

#Comment by RobLa-WMF (talk | contribs)   15:24, 24 February 2012

This really wasn't communicated well enough. The release note in r110620 doesn't read like a warning; far too easily missed. While I agree this probably never should of been committed, it's been around since 2008 and can't be lightly discarded.

The "right" way to link to this list needs to be deployed well in advance of the "wrong" way being nuked.

This needs to be reworked/reverted to fix bug 34659

#Comment by MZMcBride (talk | contribs)   22:50, 20 April 2012

You've deployed MediaWiki 1.20 with this change and end-users are now scrambling to fix broken links. This is a very suboptimal situation.

#Comment by Bawolff (talk | contribs)   17:23, 21 April 2012
  • sigh*. This is really the issue that just never dies, isn't it.
#Comment by MZMcBride (talk | contribs)   19:13, 21 April 2012

Do you have any good ideas for finding links of this nature? It seems Special links aren't tracked very easily.

#Comment by Platonides (talk | contribs)   19:37, 21 April 2012

I think the best solution would be grepping the pages-meta-current xml dumps.

Status & tagging log