r24753 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24752‎ | r24753 | r24754 >
Date:18:15, 13 August 2007
Author:robchurch
Status:old
Tags:
Comment:
* (bug 10902) Unable to fetch user contributions from IP addresses
* `list=usercontribs` no longer requires that the user exist
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryUserContributions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryUserContributions.php
@@ -93,27 +93,23 @@
9494 }
9595
9696 /**
97 - * Convert 'user' parameter into a proper user login name.
98 - * This method also validates that this user actually exists in the database.
 97+ * Validate the 'user' parameter and set the value to compare
 98+ * against `revision`.`rev_user_text`
9999 */
100100 private function getUserTitle() {
101 -
102101 $user = $this->params['user'];
103 - if (is_null($user))
104 - $this->dieUsage("User parameter may not be empty", 'param_user');
105 -
106 - $userTitle = Title::makeTitleSafe( NS_USER, $user );
107 - if ( is_null( $userTitle ) )
108 - $this->dieUsage("User name $user is not valid", 'param_user');
109 -
110 - $userid = $this->getDB()->selectField('user', 'user_id', array (
111 - 'user_name' => $userTitle->getText()
112 - ));
113 -
114 - if (!$userid)
115 - $this->dieUsage("User name $user not found", 'param_user');
116 -
117 - $this->userTitle = $userTitle;
 102+ if( $user ) {
 103+ $name = User::isIP( $user )
 104+ ? $user
 105+ : User::getCanonicalName( $user, 'valid' );
 106+ if( $name === false ) {
 107+ $this->dieUsage( "User name {$user} is not valid", 'param_user' );
 108+ } else {
 109+ $this->userTitle = $name;
 110+ }
 111+ } else {
 112+ $this->dieUsage( 'User parameter may not be empty', 'param_user' );
 113+ }
118114 }
119115
120116 /**
@@ -129,7 +125,7 @@
130126 $this->addWhereFld('rev_deleted', 0);
131127
132128 // We only want pages by the specified user.
133 - $this->addWhereFld('rev_user_text', $this->userTitle->getText());
 129+ $this->addWhereFld( 'rev_user_text', $this->userTitle );
134130
135131 // ... and in the specified timeframe.
136132 $this->addWhereRange('rev_timestamp',
Index: trunk/phase3/RELEASE-NOTES
@@ -430,6 +430,8 @@
431431 * Added rvprop=size to prop=revisions (The size will not be shown if it is NULL in the database)
432432 * list=allpages now allows to filter by article min/max size and protection status
433433 * Added site statistics (siprop=statistics for meta=siteinfo)
 434+* (bug 10902) Unable to fetch user contributions from IP addresses
 435+* `list=usercontribs` no longer requires that the user exist
434436
435437 == Maintenance script changes since 1.10 ==
436438

Follow-up revisions

RevisionCommit summaryAuthorDate
r24755Merged revisions 24694-24754 via svnmerge from...david19:48, 13 August 2007

Status & tagging log