*/
const PARAM_TEMPLATE_VARS = 25;
- /**@}*/
+ /** @} */
const ALL_DEFAULT_STRING = '*';
/** @var array Maps extension paths to info arrays */
private static $extensionInfo = null;
- /** @var int[][][] Cache for self::filterIDs() */
+ /** @var stdClass[][] Cache for self::filterIDs() */
private static $filterIDsCache = [];
/** $var array Map of web UI block messages to corresponding API messages and codes */
private static $blockMsgMap = [
'blockedtext' => [ 'apierror-blocked', 'blocked' ],
- 'blockedtext-partial' => [ 'apierror-blocked', 'blocked' ],
+ 'blockedtext-partial' => [ 'apierror-blocked-partial', 'blocked' ],
'autoblockedtext' => [ 'apierror-autoblocked', 'autoblocked' ],
'systemblockedtext' => [ 'apierror-systemblocked', 'blocked' ],
+ 'blockedtext-composite' => [ 'apierror-blocked', 'blocked' ],
];
/** @var ApiMain */
return null;
}
- /**@}*/
+ /** @} */
/************************************************************************//**
* @name Data access methods
return MediaWikiServices::getInstance()->getPermissionManager();
}
- /**@}*/
+ /** @} */
/************************************************************************//**
* @name Parameter handling
}
break;
case 'limit':
+ // Must be a number or 'max'
+ if ( $value !== 'max' ) {
+ $value = (int)$value;
+ }
+ if ( $multi ) {
+ self::dieDebug( __METHOD__, "Multi-values not supported for $encParamName" );
+ }
if ( !$parseLimit ) {
- // Don't do any validation whatsoever
+ // Don't do min/max validation and don't parse 'max'
break;
}
if ( !isset( $paramSettings[self::PARAM_MAX] )
"MAX1 or MAX2 are not defined for the limit $encParamName"
);
}
- if ( $multi ) {
- self::dieDebug( __METHOD__, "Multi-values not supported for $encParamName" );
- }
- $min = $paramSettings[self::PARAM_MIN] ?? 0;
- if ( $value == 'max' ) {
+ if ( $value === 'max' ) {
$value = $this->getMain()->canApiHighLimits()
? $paramSettings[self::PARAM_MAX2]
: $paramSettings[self::PARAM_MAX];
$this->getResult()->addParsedLimit( $this->getModuleName(), $value );
} else {
- $value = (int)$value;
$this->validateLimit(
$paramName,
$value,
- $min,
+ $paramSettings[self::PARAM_MIN] ?? 0,
$paramSettings[self::PARAM_MAX],
$paramSettings[self::PARAM_MAX2]
);
);
}
- /**@}*/
+ /** @} */
/************************************************************************//**
* @name Utility methods
} );
}
- /**@}*/
+ /** @} */
/************************************************************************//**
* @name Warning and error reporting
$user = $this->getUser();
}
$rights = (array)$rights;
- if ( !$user->isAllowedAny( ...$rights ) ) {
+ if ( !$this->getPermissionManager()
+ ->userHasAnyRight( $user, ...$rights )
+ ) {
$this->dieWithError( [ 'apierror-permissiondenied', $this->msg( "action-{$rights[0]}" ) ] );
}
}
wfDebugLog( 'api-feature-usage', $s, 'private', $ctx );
}
- /**@}*/
+ /** @} */
/************************************************************************//**
* @name Help message generation
public function modifyHelp( array &$help, array $options, array &$tocData ) {
}
- /**@}*/
+ /** @} */
}
/**