$params = $this->extractRequestParams();
$activeUserDays = $this->getConfig()->get( 'ActiveUserDays' );
- if ( $params['activeusers'] ) {
- // Update active user cache
- SpecialActiveUsers::mergeActiveUsers( 300, $activeUserDays );
- }
-
$db = $this->getDB();
$prop = $params['prop'];
// no group with the given right(s) exists, no need for a query
if ( !count( $groups ) ) {
- $this->getResult()->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), '' );
+ $this->getResult()->addIndexedTagName( array( 'query', $this->getModuleName() ), '' );
return;
}
}
$data = array(
- 'userid' => $row->user_id,
+ 'userid' => (int)$row->user_id,
'name' => $row->user_name,
);
if ( $fld_blockinfo && !is_null( $row->ipb_by_text ) ) {
- $data['blockid'] = $row->ipb_id;
+ $data['blockid'] = (int)$row->ipb_id;
$data['blockedby'] = $row->ipb_by_text;
- $data['blockedbyid'] = $row->ipb_by;
+ $data['blockedbyid'] = (int)$row->ipb_by;
$data['blockedtimestamp'] = wfTimestamp( TS_ISO_8601, $row->ipb_timestamp );
$data['blockreason'] = $row->ipb_reason;
$data['blockexpiry'] = $row->ipb_expiry;
}
if ( $row->ipb_deleted ) {
- $data['hidden'] = '';
+ $data['hidden'] = true;
}
if ( $fld_editcount ) {
$data['editcount'] = intval( $row->user_editcount );
if ( $fld_groups ) {
$data['groups'] = $groups;
- $result->setIndexedTagName( $data['groups'], 'g' );
+ ApiResult::setIndexedTagName( $data['groups'], 'g' );
+ ApiResult::setArrayType( $data['groups'], 'array' );
}
if ( $fld_implicitgroups ) {
$data['implicitgroups'] = $implicitGroups;
- $result->setIndexedTagName( $data['implicitgroups'], 'g' );
+ ApiResult::setIndexedTagName( $data['implicitgroups'], 'g' );
+ ApiResult::setArrayType( $data['implicitgroups'], 'array' );
}
if ( $fld_rights ) {
$data['rights'] = User::getGroupPermissions( $groups );
- $result->setIndexedTagName( $data['rights'], 'r' );
+ ApiResult::setIndexedTagName( $data['rights'], 'r' );
+ ApiResult::setArrayType( $data['rights'], 'array' );
}
}
}
}
- $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'u' );
+ $result->addIndexedTagName( array( 'query', $this->getModuleName() ), 'u' );
}
public function getCacheMode( $params ) {
ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
),
'witheditsonly' => false,
- 'activeusers' => false,
- );
- }
-
- public function getParamDescription() {
- return array(
- 'from' => 'The user name to start enumerating from',
- 'to' => 'The user name to stop enumerating at',
- 'prefix' => 'Search for all users that begin with this value',
- 'dir' => 'Direction to sort in',
- 'group' => 'Limit users to given group name(s)',
- 'excludegroup' => 'Exclude users in given group name(s)',
- 'rights' => 'Limit users to given right(s) (does not include rights ' .
- 'granted by implicit or auto-promoted groups like *, user, or autoconfirmed)',
- 'prop' => array(
- 'What pieces of information to include.',
- ' blockinfo - Adds the information about a current block on the user',
- ' groups - Lists groups that the user is in. This uses ' .
- 'more server resources and may return fewer results than the limit',
- ' implicitgroups - Lists all the groups the user is automatically in',
- ' rights - Lists rights that the user has',
- ' editcount - Adds the edit count of the user',
- ' registration - Adds the timestamp of when the user registered if available (may be blank)',
+ 'activeusers' => array(
+ ApiBase::PARAM_DFLT => false,
+ ApiBase::PARAM_HELP_MSG => array(
+ 'apihelp-query+allusers-param-activeusers',
+ $this->getConfig()->get( 'ActiveUserDays' )
+ ),
),
- 'limit' => 'How many total user names to return',
- 'witheditsonly' => 'Only list users who have made edits',
- 'activeusers' => "Only list users active in the last {$this->getConfig()->get( 'ActiveUserDays' )} days(s)"
);
}
- public function getDescription() {
- return 'Enumerate all registered users.';
- }
-
- public function getExamples() {
+ protected function getExamplesMessages() {
return array(
- 'api.php?action=query&list=allusers&aufrom=Y',
+ 'action=query&list=allusers&aufrom=Y'
+ => 'apihelp-query+allusers-example-Y',
);
}