$allparams = $this->getAllowedParams();
foreach( $this->mParamCache[$parseLimit] as $param => $val ) {
- if( !isset( $allparams[$param][ApiBase::PARAM_REQUIRED] ) ) {
+ if( isset( $allparams[$param][ApiBase::PARAM_REQUIRED] ) && !isset( $val ) ) {
$this->dieUsageMsg( array( 'missingparam', $param ) );
}
}
return;
}
- if ( is_null( $params['user'] ) ) {
- $this->dieUsageMsg( array( 'missingparam', 'user' ) );
- }
if ( !$wgUser->isAllowed( 'block' ) ) {
$this->dieUsageMsg( array( 'cantblock' ) );
}
public function getAllowedParams() {
return array(
- 'user' => null,
+ 'user' => array(
+ ApiBase::PARAM_TYPE => 'string',
+ ApiBase::PARAM_REQUIRED => 1
+ ),
'token' => null,
'gettoken' => false,
'expiry' => 'never',
global $wgUser;
$params = $this->extractRequestParams();
- if ( is_null( $params['title'] ) ) {
- $this->dieUsageMsg( array( 'missingparam', 'title' ) );
- }
-
if ( is_null( $params['text'] ) && is_null( $params['appendtext'] ) &&
is_null( $params['prependtext'] ) &&
$params['undo'] == 0 )
protected function getAllowedParams() {
return array(
- 'title' => null,
+ 'title' => array(
+ ApiBase::PARAM_TYPE => 'string',
+ ApiBase::PARAM_REQUIRED => 1
+ ),
'section' => null,
'text' => null,
'token' => null,
global $wgUser;
$params = $this->extractRequestParams();
- // Check required parameters
- if ( !isset( $params['target'] ) ) {
- $this->dieUsageMsg( array( 'missingparam', 'target' ) );
- }
- if ( !isset( $params['text'] ) ) {
- $this->dieUsageMsg( array( 'missingparam', 'text' ) );
- }
// Validate target
$targetUser = SpecialEmailUser::getTarget( $params['target'] );
public function getAllowedParams() {
return array(
- 'target' => null,
+ 'target' => array(
+ ApiBase::PARAM_TYPE => 'string',
+ ApiBase::PARAM_REQUIRED => 1
+ ),
'subject' => null,
- 'text' => null,
+ 'text' => array(
+ ApiBase::PARAM_TYPE => 'string',
+ ApiBase::PARAM_REQUIRED => 1
+ ),
'token' => null,
'ccme' => false,
);
}
$this->requireOnlyOneParameter( $params, 'from', 'fromid' );
- if ( !isset( $params['to'] ) ) {
- $this->dieUsageMsg( array( 'missingparam', 'to' ) );
- }
if ( isset( $params['from'] ) ) {
$fromTitle = Title::newFromText( $params['from'] );
'fromid' => array(
ApiBase::PARAM_TYPE => 'integer'
),
- 'to' => null,
+ 'to' => array(
+ ApiBase::PARAM_TYPE => 'string',
+ ApiBase::PARAM_REQUIRED => 1
+ ),
'token' => null,
'reason' => null,
'movetalk' => false,
public function execute() {
$params = $this->extractRequestParams();
- if ( !isset( $params['rcid'] ) ) {
- $this->dieUsageMsg( array( 'missingparam', 'rcid' ) );
- }
-
$rc = RecentChange::newFromID( $params['rcid'] );
if ( !$rc instanceof RecentChange ) {
$this->dieUsageMsg( array( 'nosuchrcid', $params['rcid'] ) );
return array(
'token' => null,
'rcid' => array(
- ApiBase::PARAM_TYPE => 'integer'
+ ApiBase::PARAM_TYPE => 'integer',
+ ApiBase::PARAM_REQUIRED => 1
),
);
}
$params = $this->extractRequestParams();
$titleObj = null;
- if ( !isset( $params['title'] ) ) {
- $this->dieUsageMsg( array( 'missingparam', 'title' ) );
- }
- if ( empty( $params['protections'] ) ) {
- $this->dieUsageMsg( array( 'missingparam', 'protections' ) );
- }
$titleObj = Title::newFromText( $params['title'] );
if ( !$titleObj ) {
public function getAllowedParams() {
return array(
- 'title' => null,
+ 'title' => array(
+ ApiBase::PARAM_TYPE => 'string',
+ ApiBase::PARAM_REQUIRED => 1
+ ),
'token' => null,
'protections' => array(
- ApiBase::PARAM_ISMULTI => true
+ ApiBase::PARAM_ISMULTI => true,
+ ApiBase::PARAM_REQUIRED => 1,
),
'expiry' => array(
ApiBase::PARAM_ISMULTI => true,
if ( !$wgUser->isAllowed( 'purge' ) ) {
$this->dieUsageMsg( array( 'cantpurge' ) );
}
- if ( !isset( $params['titles'] ) ) {
- $this->dieUsageMsg( array( 'missingparam', 'titles' ) );
- }
$result = array();
foreach ( $params['titles'] as $t ) {
$r = array();
public function getAllowedParams() {
return array(
'titles' => array(
- ApiBase::PARAM_ISMULTI => true
+ ApiBase::PARAM_ISMULTI => true,
+ ApiBase::PARAM_REQUIRED => 1
)
);
}
} else {
$this->rootTitle = $title;
}
- } else {
- $this->dieUsageMsg( array( 'missingparam', 'title' ) );
}
}
public function getAllowedParams() {
$retval = array(
- 'title' => null,
+ 'title' => array(
+ ApiBase::PARAM_TYPE => 'string',
+ ApiBase::PARAM_REQUIRED => 1
+ ),
'continue' => null,
'namespace' => array(
ApiBase::PARAM_ISMULTI => true,
public function getAllowedParams() {
return array(
- 'title' => null,
- 'user' => null,
+ 'title' => array(
+ ApiBase::PARAM_TYPE => 'string',
+ ApiBase::PARAM_REQUIRED => 1
+ ),
+ 'user' => array(
+ ApiBase::PARAM_TYPE => 'string',
+ ApiBase::PARAM_REQUIRED => 1
+ ),
'token' => null,
'summary' => null,
'markbot' => false,
$params = $this->extractRequestParams();
- if ( !isset( $params['user'] ) ) {
- $this->dieUsageMsg( array( 'missingparam', 'user' ) );
- }
-
// We need to be able to revert IPs, but getCanonicalName rejects them
$this->mUser = User::isIP( $params['user'] )
? $params['user']
}
$params = $this->extractRequestParams();
- if ( !isset( $params['title'] ) ) {
- $this->dieUsageMsg( array( 'missingparam', 'title' ) );
- }
$this->mTitleObj = Title::newFromText( $params['title'] );
$params = $this->extractRequestParams();
$titleObj = null;
- if ( !isset( $params['title'] ) ) {
- $this->dieUsageMsg( array( 'missingparam', 'title' ) );
- }
if ( !$wgUser->isAllowed( 'undelete' ) ) {
$this->dieUsageMsg( array( 'permdenied-undelete' ) );
public function getAllowedParams() {
return array(
- 'title' => null,
+ 'title' => array(
+ ApiBase::PARAM_TYPE => 'string',
+ ApiBase::PARAM_REQUIRED => 1
+ ),
'token' => null,
'reason' => '',
'timestamps' => array(
// One and only one of the following parameters is needed
$this->requireOnlyOneParameter( $this->mParams,
'sessionkey', 'file', 'url' );
- // And this one is needed
- if ( !isset( $this->mParams['filename'] ) ) {
- $this->dieUsageMsg( array( 'missingparam', 'filename' ) );
- }
if ( $this->mParams['sessionkey'] ) {
// Upload stashed in a previous request
public function getAllowedParams() {
$params = array(
- 'filename' => null,
+ 'filename' => array(
+ ApiBase::PARAM_TYPE => 'string',
+ ApiBase::PARAM_REQUIRED => 1
+ ),
'comment' => array(
ApiBase::PARAM_DFLT => ''
),
}
$params = $this->extractRequestParams();
- if ( is_null( $params['user'] ) ) {
- $this->dieUsageMsg( array( 'missingparam', 'user' ) );
- }
$form = new UserrightsPage;
$status = $form->fetchUser( $params['user'] );
public function getAllowedParams() {
return array (
- 'user' => null,
+ 'user' => array(
+ ApiBase::PARAM_TYPE => 'string',
+ ApiBase::PARAM_REQUIRED => 1
+ ),
'add' => array(
ApiBase::PARAM_TYPE => User::getAllGroups(),
ApiBase::PARAM_ISMULTI => true