* Moving setting of empty string to param description.
* Removing word "(optional)" from comment/reason param, because all not
required params are optional.
* Correct description of action=rollback for default comment.
Change-Id: Ifa5b60a7b55b216c43049cd81cb584b2e0518eed
$data = array(
'Target' => $params['user'],
'Reason' => array(
- is_null( $params['reason'] ) ? '' : $params['reason'],
+ $params['reason'],
'other',
- is_null( $params['reason'] ) ? '' : $params['reason']
+ $params['reason']
),
'Expiry' => $params['expiry'] == 'never' ? 'infinite' : $params['expiry'],
'HardBlock' => !$params['anononly'],
ApiBase::PARAM_DEPRECATED => true,
),
'expiry' => 'never',
- 'reason' => null,
+ 'reason' => '',
'anononly' => false,
'nocreate' => false,
'autoblock' => false,
'token' => 'A block token previously obtained through prop=info',
'gettoken' => 'If set, a block token will be returned, and no other action will be taken',
'expiry' => 'Relative expiry time, e.g. \'5 months\' or \'2 weeks\'. If set to \'infinite\', \'indefinite\' or \'never\', the block will never expire.',
- 'reason' => 'Reason for block (optional)',
+ 'reason' => 'Reason for block',
'anononly' => 'Block anonymous users only (i.e. disable anonymous edits for this IP)',
'nocreate' => 'Prevent account creation',
'autoblock' => 'Automatically block the last used IP address, and any subsequent IP addresses they try to login from',
}
$titleObj = $pageObj->getTitle();
- $reason = ( isset( $params['reason'] ) ? $params['reason'] : null );
+ $reason = $params['reason'];
$user = $this->getUser();
if ( $titleObj->getNamespace() == NS_FILE ) {
public function execute() {
$user = $this->getUser();
$params = $this->extractRequestParams();
- if ( is_null( $params['reason'] ) ) {
- $params['reason'] = '';
- }
$this->requireOnlyOneParameter( $params, 'from', 'fromid' );
ApiBase::PARAM_REQUIRED => true
),
'token' => null,
- 'reason' => null,
+ 'reason' => '',
'movetalk' => false,
'movesubpages' => false,
'noredirect' => false,
'fromid' => "Page ID of the page you want to move. Cannot be used together with {$p}from",
'to' => 'Title you want to rename the page to',
'token' => 'A move token previously retrieved through prop=info',
- 'reason' => 'Reason for the move (optional)',
+ 'reason' => 'Reason for the move',
'movetalk' => 'Move the talk page, if it exists',
'movesubpages' => 'Move subpages, if applicable',
'noredirect' => 'Don\'t create a redirect',
'protections' => 'Pipe-separated list of protection levels, formatted action=group (e.g. edit=sysop)',
'expiry' => array( 'Expiry timestamps. If only one timestamp is set, it\'ll be used for all protections.',
'Use \'infinite\', \'indefinite\' or \'never\', for a neverexpiring protection.' ),
- 'reason' => 'Reason for (un)protecting (optional)',
+ 'reason' => 'Reason for (un)protecting',
'cascade' => array( 'Enable cascading protection (i.e. protect pages included in this page)',
'Ignored if not all protection levels are \'sysop\' or \'protect\'' ),
'watch' => 'If set, add the page being (un)protected to your watchlist',
// User and title already validated in call to getTokenSalt from Main
$titleObj = $this->getRbTitle();
$pageObj = WikiPage::factory( $titleObj );
- $summary = ( isset( $params['summary'] ) ? $params['summary'] : '' );
+ $summary = $params['summary'];
$details = array();
$retval = $pageObj->doRollback( $this->getRbUser(), $summary, $params['token'], $params['markbot'], $details, $this->getUser() );
ApiBase::PARAM_REQUIRED => true
),
'token' => null,
- 'summary' => null,
+ 'summary' => '',
'markbot' => false,
'watchlist' => array(
ApiBase::PARAM_DFLT => 'preferences',
'title' => 'Title of the page you want to rollback.',
'user' => 'Name of the user whose edits are to be rolled back. If set incorrectly, you\'ll get a badtoken error.',
'token' => "A rollback token previously retrieved through {$this->getModulePrefix()}prop=revisions",
- 'summary' => 'Custom edit summary. If not set, default summary will be used',
+ 'summary' => 'Custom edit summary. If empty, default summary will be used',
'markbot' => 'Mark the reverted edits and the revert as bot edits',
'watchlist' => 'Unconditionally add or remove the page from your watchlist, use preferences or do not change watch',
);
$data = array(
'Target' => is_null( $params['id'] ) ? $params['user'] : "#{$params['id']}",
- 'Reason' => is_null( $params['reason'] ) ? '' : $params['reason']
+ 'Reason' => $params['reason']
);
$block = Block::newFromTarget( $data['Target'] );
$retval = SpecialUnblock::processUnblock( $data, $this->getContext() );
ApiBase::PARAM_DFLT => false,
ApiBase::PARAM_DEPRECATED => true,
),
- 'reason' => null,
+ 'reason' => '',
);
}
'user' => "Username, IP address or IP range you want to unblock. Cannot be used together with {$p}id",
'token' => "An unblock token previously obtained through prop=info",
'gettoken' => 'If set, an unblock token will be returned, and no other action will be taken',
- 'reason' => 'Reason for unblock (optional)',
+ 'reason' => 'Reason for unblock',
);
}
return array(
'title' => 'Title of the page you want to restore',
'token' => 'An undelete token previously retrieved through list=deletedrevs',
- 'reason' => 'Reason for restoring (optional)',
+ 'reason' => 'Reason for restoring',
'timestamps' => 'Timestamps of the revisions to restore. If not set, all revisions will be restored.',
'watchlist' => 'Unconditionally add or remove the page from your watchlist, use preferences or do not change watch',
);