r85687 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85686‎ | r85687 | r85688 >
Date:20:20, 8 April 2011
Author:ialex
Status:deferred (Comments)
Tags:
Comment:
* Simplify a bit; use the $username parameter
* Removed unused global
Modified paths:
  • /trunk/extensions/AjaxShowEditors/Response.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AjaxShowEditors/Response.php
@@ -14,21 +14,15 @@
1515 * @author Tim Starling
1616 */
1717 function wfAjaxShowEditors( $articleId, $username ) {
18 - global $wgOut;
19 -
2018 $articleId = intval( $articleId );
2119
2220 // Validate request
2321 $title = Title::newFromID( $articleId );
2422 if ( !( $title ) ) { return wfMsg( 'ajax-se-pagedoesnotexist' ); }
2523
26 - $user = User::newFromSession() ;
27 - if ( !$user ) { return wfMsg( 'ajax-se-userinvalid' ); }
 24+ if ( User::idFromName( $username ) === null ) { return wfMsg( 'ajax-se-usernotfound' ); }
2825
29 - $username = $user->getName();
30 - if ( !( $user->isLoggedIn() or User::isIP( $username ) ) ) { return wfMsg( 'ajax-se-usernotfound' ); }
3126
32 -
3327 // When did the user started editing ?
3428 $dbr = wfGetDB( DB_SLAVE );
3529 $userStarted = $dbr->selectField( 'editings',

Comments

#Comment by Nikerabbit (talk | contribs)   19:02, 9 April 2011

Could also cleanup if ( !( $title ) )  :)

Status & tagging log