$vals['name'] = $user->getName();
if ( $user->isAnon() ) {
- $vals['anon'] = '';
+ $vals['anon'] = true;
}
if ( isset( $this->prop['blockinfo'] ) ) {
}
}
- if ( isset( $this->prop['hasmsg'] ) && $user->getNewtalk() ) {
- $vals['messages'] = '';
+ if ( isset( $this->prop['hasmsg'] ) ) {
+ $vals['messages'] = $user->getNewtalk();
}
if ( isset( $this->prop['groups'] ) ) {
$vals['groups'] = $user->getEffectiveGroups();
+ ApiResult::setArrayType( $vals['groups'], 'array' ); // even if empty
ApiResult::setIndexedTagName( $vals['groups'], 'g' ); // even if empty
}
if ( isset( $this->prop['implicitgroups'] ) ) {
$vals['implicitgroups'] = $user->getAutomaticGroups();
+ ApiResult::setArrayType( $vals['implicitgroups'], 'array' ); // even if empty
ApiResult::setIndexedTagName( $vals['implicitgroups'], 'g' ); // even if empty
}
if ( isset( $this->prop['rights'] ) ) {
// User::getRights() may return duplicate values, strip them
$vals['rights'] = array_values( array_unique( $user->getRights() ) );
+ ApiResult::setArrayType( $vals['rights'], 'array' ); // even if empty
ApiResult::setIndexedTagName( $vals['rights'], 'r' ); // even if empty
}
if ( isset( $this->prop['options'] ) ) {
$vals['options'] = $user->getOptions();
+ $vals['options'][ApiResult::META_BC_BOOLS] = array_keys( $vals['options'] );
}
if ( isset( $this->prop['preferencestoken'] ) ) {
}
protected function getRateLimits() {
+ $retval = array(
+ ApiResult::META_TYPE => 'assoc',
+ );
+
$user = $this->getUser();
if ( !$user->isPingLimitable() ) {
- return array(); // No limits
+ return $retval; // No limits
}
// Find out which categories we belong to
$categories = array_merge( $categories, $user->getGroups() );
// Now get the actual limits
- $retval = array();
foreach ( $this->getConfig()->get( 'RateLimits' ) as $action => $limits ) {
foreach ( $categories as $cat ) {
if ( isset( $limits[$cat] ) && !is_null( $limits[$cat] ) ) {