}
}
+ $editingRestriction = 'sitewide';
+ $pageRestrictions = '';
+ if ( $this->getConfig()->get( 'EnablePartialBlocks' ) ) {
+ if ( $params['pagerestrictions'] ) {
+ $count = count( $params['pagerestrictions'] );
+ if ( $count > 10 ) {
+ $this->dieWithError(
+ $this->msg(
+ 'apierror-integeroutofrange-abovebotmax',
+ 'pagerestrictions',
+ 10,
+ $count
+ )
+ );
+ }
+ }
+
+ if ( $params['partial'] ) {
+ $editingRestriction = 'partial';
+ }
+
+ $pageRestrictions = implode( "\n", $params['pagerestrictions'] );
+ }
+
if ( $params['userid'] !== null ) {
$username = User::whoIs( $params['userid'] );
'Watch' => $params['watchuser'],
'Confirm' => true,
'Tags' => $params['tags'],
+ 'EditingRestriction' => $editingRestriction,
+ 'PageRestrictions' => $pageRestrictions,
];
$retval = SpecialBlock::processForm( $data, $this->getContext() );
$res['allowusertalk'] = $params['allowusertalk'];
$res['watchuser'] = $params['watchuser'];
+ if ( $this->getConfig()->get( 'EnablePartialBlocks' ) ) {
+ $res['partial'] = $params['partial'];
+ $res['pagerestrictions'] = $params['pagerestrictions'];
+ }
+
$this->getResult()->addValue( null, $this->getModuleName(), $res );
}
}
public function getAllowedParams() {
- return [
+ $params = [
'user' => [
ApiBase::PARAM_TYPE => 'user',
],
ApiBase::PARAM_ISMULTI => true,
],
];
+
+ if ( $this->getConfig()->get( 'EnablePartialBlocks' ) ) {
+ $params['partial'] = false;
+ $params['pagerestrictions'] = [
+ ApiBase::PARAM_ISMULTI => true,
+ ];
+ }
+
+ return $params;
}
public function needsToken() {