X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Flogging%2FBlockLogFormatter.php;h=ddecf9ead5dbbc8be0f8d01b4a9eb62fdb7b8d5d;hb=603740b43b9c787813e2e2b1b4bb82d1cd83ef1f;hp=6bc3f3969a88233332d9ba2217f0373489c23cef;hpb=83ec9c66498ced5c95f52de4fd0ad54b0546b116;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/logging/BlockLogFormatter.php b/includes/logging/BlockLogFormatter.php index 6bc3f3969a..ddecf9ead5 100644 --- a/includes/logging/BlockLogFormatter.php +++ b/includes/logging/BlockLogFormatter.php @@ -77,12 +77,34 @@ class BlockLogFormatter extends LogFormatter { // block restrictions if ( isset( $params[6] ) ) { $pages = $params[6]['pages'] ?? []; - $pages = array_map( function ( $page ){ - return $this->makePageLink( Title::newFromText( ( $page ) ) ); + $pages = array_map( function ( $page ) { + 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 ) ); } } @@ -253,6 +275,10 @@ class BlockLogFormatter extends LogFormatter { ApiResult::setIndexedTagName( $ret['restrictions']['pages'], 'p' ); } + if ( isset( $ret['restrictions']['namespaces'] ) ) { + ApiResult::setIndexedTagName( $ret['restrictions']['namespaces'], 'ns' ); + } + return $ret; }