return $this->makePageLink( Title::newFromText( ( $page ) ) );
}, $pages );
- $params[6] = Message::rawParam( $this->context->getLanguage()->listToText( $pages ) );
- $params[7] = count( $pages );
+ $namespaces = $params[6]['namespaces'] ?? [];
+ $namespaces = array_map( function ( $ns ) {
+ $text = (int)$ns === NS_MAIN
+ ? $this->msg( 'blanknamespace' )->text()
+ : $this->context->getLanguage()->getFormattedNsText( $ns );
+ $params = [ 'namespace' => $ns ];
+
+ return $this->makePageLink( SpecialPage::getTitleFor( 'Allpages' ), $params, $text );
+ }, $namespaces );
+
+ $restrictions = [];
+ if ( $pages ) {
+ $restrictions[] = $this->msg( 'logentry-partialblock-block-page' )
+ ->numParams( count( $pages ) )
+ ->rawParams( $this->context->getLanguage()->listToText( $pages ) )->text();
+ }
+
+ if ( $namespaces ) {
+ $restrictions[] = $this->msg( 'logentry-partialblock-block-ns' )
+ ->numParams( count( $namespaces ) )
+ ->rawParams( $this->context->getLanguage()->listToText( $namespaces ) )->text();
+ }
+
+ $params[6] = Message::rawParam( $this->context->getLanguage()->listToText( $restrictions ) );
}
}
ApiResult::setIndexedTagName( $ret['restrictions']['pages'], 'p' );
}
+ if ( isset( $ret['restrictions']['namespaces'] ) ) {
+ ApiResult::setIndexedTagName( $ret['restrictions']['namespaces'], 'ns' );
+ }
+
return $ret;
}
$logParams['6::flags'] = self::blockLogFlags( $data, $type );
$logParams['sitewide'] = $block->isSitewide();
- if ( $enablePartialBlocks && $data['PageRestrictions'] !== '' ) {
- $logParams['7::restrictions'] = [
- 'pages' => explode( "\n", $data['PageRestrictions'] ),
- ];
+ if ( $enablePartialBlocks && !$block->isSitewide() ) {
+ if ( $data['PageRestrictions'] !== '' ) {
+ $logParams['7::restrictions']['pages'] = explode( "\n", $data['PageRestrictions'] );
+ }
+
+ if ( $data['NamespaceRestrictions'] !== '' ) {
+ $logParams['7::restrictions']['namespaces'] = explode( "\n", $data['NamespaceRestrictions'] );
+ }
}
# Make log entry, if the name is hidden, put it in the suppression log
"logentry-block-block": "$1 {{GENDER:$2|blocked}} {{GENDER:$4|$3}} with an expiration time of $5 $6",
"logentry-block-unblock": "$1 {{GENDER:$2|unblocked}} {{GENDER:$4|$3}}",
"logentry-block-reblock": "$1 {{GENDER:$2|changed}} block settings for {{GENDER:$4|$3}} with an expiration time of $5 $6",
- "logentry-partialblock-block": "$1 {{GENDER:$2|blocked}} {{GENDER:$4|$3}} from editing {{PLURAL:$8||the pages}} $7 with an expiration time of $5 $6",
- "logentry-partialblock-reblock": "$1 {{GENDER:$2|changed}} block settings for {{GENDER:$4|$3}} preventing edits on {{PLURAL:$8||the pages}} $7 with an expiration time of $5 $6",
+ "logentry-partialblock-block-page": "the {{PLURAL:$1|page|pages}} $2",
+ "logentry-partialblock-block-ns": "the {{PLURAL:$1|namespace|namespaces}} $2",
+ "logentry-partialblock-block": "$1 {{GENDER:$2|blocked}} {{GENDER:$4|$3}} from editing $7 with an expiration time of $5 $6",
+ "logentry-partialblock-reblock": "$1 {{GENDER:$2|changed}} block settings for {{GENDER:$4|$3}} preventing edits on $7 with an expiration time of $5 $6",
"logentry-non-editing-block-block": "$1 {{GENDER:$2|blocked}} {{GENDER:$4|$3}} from specified non-editing actions with an expiration time of $5 $6",
"logentry-non-editing-block-reblock": "$1 {{GENDER:$2|changed}} block settings for {{GENDER:$4|$3}} for specified non-editing actions with an expiration time of $5 $6",
"logentry-suppress-block": "$1 {{GENDER:$2|blocked}} {{GENDER:$4|$3}} with an expiration time of $5 $6",
"logentry-block-block": "{{Logentry|[[Special:Log/block]]}}\n* $4 - user name for gender or empty string for autoblocks\n* $5 - the block duration, localized and formatted with the english tooltip\n* $6 - block detail flags or empty string\n\nCf. {{msg-mw|Blocklogentry}}",
"logentry-block-unblock": "{{Logentry|[[Special:Log/block]]}}\n* $4 - user name for gender or empty string for autoblocks\n\nCf. {{msg-mw|Unblocklogentry}}",
"logentry-block-reblock": "{{Logentry|[[Special:Log/block]]}}\n* $4 - user name for gender or empty string for autoblocks\n* $5 - the block duration, localized and formatted with the english tooltip\n* $6 - block detail flags or empty string\n\nCf. {{msg-mw|Reblock-logentry}}",
- "logentry-partialblock-block": "{{Logentry|[[Special:Log/block]]}}\n* $4 - user name for gender or empty string for autoblocks\n* $5 - the block duration, localized and formatted with the english tooltip\n* $6 - block detail flags or empty string\n* $7 - list of pages separated by a comma\n* $8 - total number of pages\n\nCf. {{msg-mw|Blocklogentry}}",
- "logentry-partialblock-reblock": "{{Logentry|[[Special:Log/block]]}}\n* $4 - user name for gender or empty string for autoblocks\n* $5 - the block duration, localized and formatted with the english tooltip\n* $6 - block detail flags or empty string\n* $7 - list of pages separated by a comma\n* $8 - total number of pages\n\nCf. {{msg-mw|Reblock-logentry}}",
+ "logentry-partialblock-block-page": "Page portion of {{msg-mw|logentry-partialblock-block}}\n* $1 - number of pages\n* - $2 list of pages",
+ "logentry-partialblock-block-ns": "Namespace portion of {{msg-mw|logentry-partialblock-block}}\n* $1 - number of namespaces\n* - $2 list of namespaces",
+ "logentry-partialblock-block": "{{Logentry|[[Special:Log/block]]}}\n* $4 - user name for gender or empty string for autoblocks\n* $5 - the block duration, localized and formatted with the english tooltip\n* $6 - block detail flags or empty string\n* $7 - Restrictions list {{msg-mw|logentry-partialblock-page}} and/or {{msg-mw|logentry-partialblock-block-ns}}\n\nCf. {{msg-mw|Blocklogentry}}",
+ "logentry-partialblock-reblock": "{{Logentry|[[Special:Log/block]]}}\n* $4 - user name for gender or empty string for autoblocks\n* $5 - the block duration, localized and formatted with the english tooltip\n* $6 - block detail flags or empty string\n* $7 - Restrictions list{{msg-mw|logentry-partialblock-page}} and/or {{msg-mw|logentry-partialblock-block-ns}}\n\nCf. {{msg-mw|Reblock-logentry}}",
"logentry-non-editing-block-block": "{{Logentry|[[Special:Log/block]]}}\n* $4 - user name for gender or empty string for autoblocks\n* $5 - the block duration, localized and formatted with the english tooltip\n* $6 - block detail flags or empty string\n\nCf. {{msg-mw|Blocklogentry}}",
"logentry-non-editing-block-reblock": "{{Logentry|[[Special:Log/block]]}}\n* $4 - user name for gender or empty string for autoblocks\n* $5 - the block duration, localized and formatted with the english tooltip\n* $6 - block detail flags or empty string\n\nCf. {{msg-mw|Reblock-logentry}}",
"logentry-suppress-block": "{{Logentry}}\n* $4 - user name for gender or empty string for autoblocks\n* $5 - the block duration, localized and formatted with the english tooltip\n* $6 - block detail flags or empty string",
'api' => [
'duration' => 'infinite',
'flags' => [ 'anononly' ],
- 'restrictions' => [ 'pages' => [
+ 'restrictions' => [
+ 'pages' => [
[
'page_ns' => 2,
'page_title' => 'User:Test1',
],
],
],
+ [
+ [
+ 'type' => 'block',
+ 'action' => 'block',
+ 'comment' => 'Block comment',
+ 'user' => 0,
+ 'user_text' => 'Sysop',
+ 'namespace' => NS_USER,
+ 'title' => 'Logtestuser',
+ 'params' => [
+ '5::duration' => 'infinite',
+ '6::flags' => 'anononly',
+ '7::restrictions' => [
+ 'namespaces' => [ NS_USER ],
+ ],
+ 'sitewide' => false,
+ ],
+ ],
+ [
+ 'text' => 'Sysop blocked Logtestuser from editing the namespace User'
+ . ' with an expiration time of indefinite (anonymous users only)',
+ 'api' => [
+ 'duration' => 'infinite',
+ 'flags' => [ 'anononly' ],
+ 'restrictions' => [
+ 'namespaces' => [ NS_USER ],
+ ],
+ 'sitewide' => false,
+ ],
+ ],
+ ],
+ [
+ [
+ 'type' => 'block',
+ 'action' => 'block',
+ 'comment' => 'Block comment',
+ 'user' => 0,
+ 'user_text' => 'Sysop',
+ 'namespace' => NS_USER,
+ 'title' => 'Logtestuser',
+ 'params' => [
+ '5::duration' => 'infinite',
+ '6::flags' => 'anononly',
+ '7::restrictions' => [
+ 'pages' => [ 'Main Page' ],
+ 'namespaces' => [ NS_USER, NS_MAIN ],
+ ],
+ 'sitewide' => false,
+ ],
+ ],
+ [
+ 'text' => 'Sysop blocked Logtestuser from editing the page Main Page and the'
+ . ' namespaces User and (Main) with an expiration time of indefinite'
+ . ' (anonymous users only)',
+ 'api' => [
+ 'duration' => 'infinite',
+ 'flags' => [ 'anononly' ],
+ 'restrictions' => [
+ 'pages' => [
+ [
+ 'page_ns' => 0,
+ 'page_title' => 'Main Page',
+ ],
+ ],
+ 'namespaces' => [ NS_USER, NS_MAIN ],
+ ],
+ 'sitewide' => false,
+ ],
+ ],
+ ],
[
[
'type' => 'block',