Index: trunk/phase3/includes/api/ApiQueryUserContributions.php |
— | — | @@ -93,27 +93,23 @@ |
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
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` |
99 | 99 | */ |
100 | 100 | private function getUserTitle() { |
101 | | - |
102 | 101 | $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 | + } |
118 | 114 | } |
119 | 115 | |
120 | 116 | /** |
— | — | @@ -129,7 +125,7 @@ |
130 | 126 | $this->addWhereFld('rev_deleted', 0); |
131 | 127 | |
132 | 128 | // 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 ); |
134 | 130 | |
135 | 131 | // ... and in the specified timeframe. |
136 | 132 | $this->addWhereRange('rev_timestamp', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -430,6 +430,8 @@ |
431 | 431 | * Added rvprop=size to prop=revisions (The size will not be shown if it is NULL in the database) |
432 | 432 | * list=allpages now allows to filter by article min/max size and protection status |
433 | 433 | * 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 |
434 | 436 | |
435 | 437 | == Maintenance script changes since 1.10 == |
436 | 438 | |