34 $params = parent::getMessageParameters();
36 $title = $this->entry->getTarget();
37 if ( substr(
$title->getText(), 0, 1 ) ===
'#' ) {
39 $params[2] =
$title->getText();
43 $username =
$title->getText();
48 $params[3] = $username;
51 $subtype = $this->entry->getSubtype();
52 if ( $subtype ===
'block' || $subtype ===
'reblock' ) {
53 if ( !isset( $params[4] ) ) {
55 $params[4] =
'infinite';
61 $durationTooltip =
'‎' . htmlspecialchars( $params[4] );
62 $blockExpiry = $this->context->getLanguage()->translateBlockExpiry(
64 $this->context->getUser(),
65 wfTimestamp( TS_UNIX, $this->entry->getTimestamp() )
67 if ( $this->plaintext ) {
68 $params[4] = Message::rawParam( $blockExpiry );
70 $params[4] = Message::rawParam(
71 "<span class=\"blockExpiry\" title=\"$durationTooltip\">" .
76 $params[5] = isset( $params[5] ) ?
80 if ( isset( $params[6] ) ) {
81 $pages = $params[6][
'pages'] ?? [];
82 $pages = array_map(
function ( $page ) {
86 $namespaces = $params[6][
'namespaces'] ?? [];
87 $namespaces = array_map(
function ( $ns ) {
89 ? $this->
msg(
'blanknamespace' )->text()
90 : $this->context->getLanguage()->getFormattedNsText( $ns );
91 $params = [
'namespace' => $ns ];
98 $restrictions[] = $this->
msg(
'logentry-partialblock-block-page' )
99 ->numParams( count( $pages ) )
100 ->rawParams( $this->context->getLanguage()->listToText( $pages ) )->text();
104 $restrictions[] = $this->
msg(
'logentry-partialblock-block-ns' )
105 ->numParams( count( $namespaces ) )
106 ->rawParams( $this->context->getLanguage()->listToText( $namespaces ) )->text();
109 $params[6] = Message::rawParam( $this->context->getLanguage()->listToText( $restrictions ) );
117 $params = parent::extractParameters();
119 if ( $this->entry->isLegacy() && isset( $params[3] ) ) {
120 if ( isset( $params[4] ) ) {
121 $params[5] = $params[4];
123 $params[4] = $params[3];
130 $title = $this->entry->getTarget();
132 if ( substr(
$title->getText(), 0, 1 ) !==
'#' &&
$title->isValid() ) {
133 return [
$title->getTalkPage() ];
139 $subtype = $this->entry->getSubtype();
142 || !( $subtype ===
'block' || $subtype ===
'reblock' )
143 || !MediaWikiServices::getInstance()
144 ->getPermissionManager()
145 ->userHasRight( $this->context->getUser(),
'block' )
151 $title = $this->entry->getTarget();
155 $this->
msg(
'unblocklink' )->text()
159 $this->
msg(
'change-blocklink' )->text()
163 return $this->
msg(
'parentheses' )->rawParams(
164 $this->context->getLanguage()->pipeList( $links ) )->escaped();
176 $flags = trim( $flags );
177 if ( $flags ===
'' ) {
180 $flags = explode(
',', $flags );
181 $flagsCount = count( $flags );
183 for ( $i = 0; $i < $flagsCount; $i++ ) {
188 ->rawParams(
$lang->commaList( $flags ) )->escaped();
199 static $messages = [];
201 if ( !isset( $messages[$flag] ) ) {
202 $messages[$flag] = htmlspecialchars( $flag );
212 $msg =
wfMessage(
'block-log-flags-' . $flag )->inLanguage(
$lang );
214 if ( $msg->exists() ) {
215 $messages[$flag] = $msg->escaped();
219 return $messages[$flag];
231 '6::flags' =>
'6:array:flags',
234 foreach ( $map as $index => $key ) {
235 if ( isset( $params[$index] ) ) {
236 $params[$key] = $params[$index];
237 unset( $params[$index] );
244 if ( $subtype ===
'block' || $subtype ===
'reblock' ) {
247 '5::duration' =>
'infinite',
248 '6:array:flags' => [],
251 if ( !is_array( $params[
'6:array:flags'] ) ) {
252 $params[
'6:array:flags'] = $params[
'6:array:flags'] ===
''
254 : explode(
',', $params[
'6:array:flags'] );
259 $expiry = strtotime( $params[
'5::duration'], $ts );
260 if ( $expiry !==
false && $expiry > 0 ) {
261 $params[
':timestamp:expiry'] = $expiry;
274 $ret = parent::formatParametersForApi();
275 if ( isset( $ret[
'flags'] ) ) {
279 if ( isset( $ret[
'restrictions'][
'pages'] ) ) {
280 $ret[
'restrictions'][
'pages'] = array_map(
function (
$title ) {
282 }, $ret[
'restrictions'][
'pages'] );
286 if ( isset( $ret[
'restrictions'][
'namespaces'] ) ) {
294 $type = $this->entry->getType();
295 $subtype = $this->entry->getSubtype();
296 $sitewide = $this->entry->getParameters()[
'sitewide'] ??
true;
298 $key =
"logentry-$type-$subtype";
299 if ( ( $subtype ===
'block' || $subtype ===
'reblock' ) && !$sitewide ) {
303 $params = parent::getMessageParameters();
306 if ( isset( $params[6] ) ) {
307 $key =
"logentry-partial$type-$subtype";
309 $key =
"logentry-non-editing-$type-$subtype";