);
$params[5] = isset( $params[5] ) ?
self::formatBlockFlags( $params[5], $this->context->getLanguage() ) : '';
+
+ // block restrictions
+ if ( isset( $params[6] ) ) {
+ $pages = $params[6]['pages'] ?? [];
+ $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 );
+ }
}
return $params;
'6:array:flags',
'6::flags' => '6:array:flags',
];
+
foreach ( $map as $index => $key ) {
if ( isset( $params[$index] ) ) {
$params[$key] = $params[$index];
}
}
+ ksort( $params );
+
$subtype = $entry->getSubtype();
if ( $subtype === 'block' || $subtype === 'reblock' ) {
// Defaults for old log entries missing some fields
if ( isset( $ret['flags'] ) ) {
ApiResult::setIndexedTagName( $ret['flags'], 'f' );
}
+
+ if ( isset( $ret['restrictions']['pages'] ) ) {
+ $ret['restrictions']['pages'] = array_map( function ( $title ) {
+ return $this->formatParameterValueForApi( 'page', 'title-link', $title );
+ }, $ret['restrictions']['pages'] );
+ ApiResult::setIndexedTagName( $ret['restrictions']['pages'], 'p' );
+ }
+
return $ret;
}
+ protected function getMessageKey() {
+ $type = $this->entry->getType();
+ $subtype = $this->entry->getSubtype();
+ $sitewide = $this->entry->getParameters()['sitewide'] ?? true;
+
+ $key = "logentry-$type-$subtype";
+ if ( ( $subtype === 'block' || $subtype === 'reblock' ) && !$sitewide ) {
+ // $this->getMessageParameters is doing too much. We just need
+ // to check the presence of restrictions ($param[6]) and calling
+ // on parent gives us that
+ $params = parent::getMessageParameters();
+
+ // message changes depending on whether there are editing restrictions or not
+ if ( isset( $params[6] ) ) {
+ $key = "logentry-partial$type-$subtype";
+ } else {
+ $key = "logentry-non-editing-$type-$subtype";
+ }
+ }
+
+ return $key;
+ }
}