The API 'user' type accepts both user names and IP addresses, and
applies normalization but not canonicalization. We should be using this
on basically every user parameter to ensure that e.g. IPv6 usernames get
uppercased.
Bug: T122803
Change-Id: Ic67fb54061ac311e54f325b2a1a4658f43b8fef4
* - timestamp: A timestamp in any format recognized by MWTimestamp, or the
* string 'now' representing the current timestamp. Will be returned in
* TS_MW format.
* - timestamp: A timestamp in any format recognized by MWTimestamp, or the
* string 'now' representing the current timestamp. Will be returned in
* TS_MW format.
- * - user: A MediaWiki username. Will be returned normalized but not canonicalized.
+ * - user: A MediaWiki username or IP. Will be returned normalized but not canonicalized.
* - upload: An uploaded file. Will be returned as a WebRequestUpload object.
* Cannot be used with PARAM_ISMULTI.
*/
* - upload: An uploaded file. Will be returned as a WebRequestUpload object.
* Cannot be used with PARAM_ISMULTI.
*/
public function getAllowedParams() {
return array(
'user' => array(
public function getAllowedParams() {
return array(
'user' => array(
- ApiBase::PARAM_TYPE => 'string',
+ ApiBase::PARAM_TYPE => 'user',
ApiBase::PARAM_REQUIRED => true
),
'expiry' => 'never',
ApiBase::PARAM_REQUIRED => true
),
'expiry' => 'never',
ApiBase::PARAM_ISMULTI => true
),
'users' => array(
ApiBase::PARAM_ISMULTI => true
),
'users' => array(
+ ApiBase::PARAM_TYPE => 'user',
ApiBase::PARAM_ISMULTI => true
),
'ip' => array(
ApiBase::PARAM_ISMULTI => true
),
'ip' => array(
if ( $userid ) {
$this->addWhereFld( 'log_user', $userid );
} else {
if ( $userid ) {
$this->addWhereFld( 'log_user', $userid );
} else {
- $this->addWhereFld( 'log_user_text', IP::sanitizeIP( $user ) );
+ $this->addWhereFld( 'log_user_text', $user );
),
ApiBase::PARAM_HELP_MSG => 'api-help-param-direction',
),
),
ApiBase::PARAM_HELP_MSG => 'api-help-param-direction',
),
+ 'user' => array(
+ ApiBase::PARAM_TYPE => 'user',
+ ),
'title' => null,
'namespace' => array(
ApiBase::PARAM_TYPE => 'namespace'
'title' => null,
'namespace' => array(
ApiBase::PARAM_TYPE => 'namespace'
ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
),
'user' => array(
ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
),
'user' => array(
+ ApiBase::PARAM_TYPE => 'user',
ApiBase::PARAM_ISMULTI => true
),
'userprefix' => null,
ApiBase::PARAM_ISMULTI => true
),
'userprefix' => null,
),
'attachedwiki' => null,
'users' => array(
),
'attachedwiki' => null,
'users' => array(
+ ApiBase::PARAM_TYPE => 'user',
ApiBase::PARAM_ISMULTI => true
),
'token' => array(
ApiBase::PARAM_ISMULTI => true
),
'token' => array(
ApiBase::PARAM_ISMULTI => true,
),
'user' => array(
ApiBase::PARAM_ISMULTI => true,
),
'user' => array(
- ApiBase::PARAM_TYPE => 'string',
+ ApiBase::PARAM_TYPE => 'user',
ApiBase::PARAM_REQUIRED => true
),
'summary' => '',
ApiBase::PARAM_REQUIRED => true
),
'summary' => '',
public function getAllowedParams() {
return array(
'user' => array(
public function getAllowedParams() {
return array(
'user' => array(
- ApiBase::PARAM_TYPE => 'string',
+ ApiBase::PARAM_TYPE => 'user',
),
'userid' => array(
ApiBase::PARAM_TYPE => 'integer',
),
'userid' => array(
ApiBase::PARAM_TYPE => 'integer',