130 if ( $msg ===
null ) {
133 'createaccountblock',
136 'blocklist-nousertalk',
140 'blocklist-editing-sitewide',
143 foreach (
$keys as $key ) {
144 $msg[$key] = $this->
msg( $key )->text();
147 '@phan-var string[] $msg';
159 case 'ipb_timestamp':
160 $formatted = htmlspecialchars( $language->userTimeAndDate( $value, $this->getUser() ) );
164 if ( $row->ipb_auto ) {
165 $formatted = $this->
msg(
'autoblockid', $row->ipb_id )->parse();
167 list( $target, ) = $this->blockUtils->parseBlockTarget( $row->ipb_address );
169 if ( is_string( $target ) ) {
170 if ( IPUtils::isValidRange( $target ) ) {
173 $formatted = $target;
190 $formatted = htmlspecialchars( $language->formatExpiry(
198 if ( $row->ipb_auto ) {
200 $this->specialPageFactory->getTitleForAlias(
'Unblock' ),
203 [
'wpTarget' =>
"#{$row->ipb_id}" ]
207 $this->specialPageFactory->getTitleForAlias(
'Unblock/' . $row->ipb_address ),
211 $this->specialPageFactory->getTitleForAlias(
'Block/' . $row->ipb_address ),
212 $msg[
'change-blocklink']
215 $formatted .=
' ' . Html::rawElement(
217 [
'class' =>
'mw-blocklist-actions' ],
218 $this->
msg(
'parentheses' )->rawParams(
219 $language->pipeList( $links ) )->escaped()
222 if ( $value !==
'infinity' ) {
224 $formatted .=
'<br />' . $this->
msg(
225 'ipb-blocklist-duration-left',
226 $language->formatDuration(
227 $timestamp->getTimestamp() - MWTimestamp::time(),
246 $value = $this->commentStore->getComment(
'ipb_reason', $row )->text;
253 if ( $row->ipb_sitewide ) {
254 $properties[] = htmlspecialchars( $msg[
'blocklist-editing-sitewide'] );
257 if ( !$row->ipb_sitewide && $this->restrictions ) {
260 $properties[] = htmlspecialchars( $msg[
'blocklist-editing'] ) . $list;
264 if ( $row->ipb_anon_only ) {
265 $properties[] = htmlspecialchars( $msg[
'anononlyblock'] );
267 if ( $row->ipb_create_account ) {
268 $properties[] = htmlspecialchars( $msg[
'createaccountblock'] );
270 if ( $row->ipb_user && !$row->ipb_enable_autoblock ) {
271 $properties[] = htmlspecialchars( $msg[
'noautoblockblock'] );
274 if ( $row->ipb_block_email ) {
275 $properties[] = htmlspecialchars( $msg[
'emailblock'] );
278 if ( !$row->ipb_allow_usertalk ) {
279 $properties[] = htmlspecialchars( $msg[
'blocklist-nousertalk'] );
282 $formatted = Html::rawElement(
285 implode(
'', array_map(
static function ( $prop ) {
286 return Html::rawElement(
296 $formatted =
"Unable to format $name";
314 foreach ( $this->restrictions as $restriction ) {
315 if ( $restriction->getBlockId() !== (
int)$row->ipb_id ) {
319 switch ( $restriction->getType() ) {
320 case PageRestriction::TYPE:
321 '@phan-var PageRestriction $restriction';
322 if ( $restriction->getTitle() ) {
323 $items[$restriction->getType()][] = Html::rawElement(
330 case NamespaceRestriction::TYPE:
331 $text = $restriction->getValue() ===
NS_MAIN
332 ? $this->
msg(
'blanknamespace' )->text()
334 $restriction->getValue()
337 $items[$restriction->getType()][] = Html::rawElement(
341 $this->specialPageFactory->getTitleForAlias(
'Allpages' ),
345 'namespace' => $restriction->getValue()
351 case ActionRestriction::TYPE:
352 $actionName = $this->blockActionInfo->getActionFromId( $restriction->getValue() );
353 $enablePartialActionBlocks = $this->
getConfig()->get(
'EnablePartialActionBlocks' );
354 if ( $actionName && $enablePartialActionBlocks ) {
355 $items[$restriction->getType()][] = Html::rawElement(
358 $this->
msg(
'ipb-action-' .
359 $this->blockActionInfo->getActionFromId( $restriction->getValue() ) )->escaped()
366 if ( empty( $items ) ) {
371 foreach ( $items as $key => $value ) {
372 $sets[] = Html::rawElement(
375 $this->
msg(
'blocklist-editing-' . $key ) . Html::rawElement(
378 implode(
'', $value )
383 return Html::rawElement(
472 # Do a link batch query
473 $lb = $this->linkBatchFactory->newLinkBatch();
474 $lb->setCaller( __METHOD__ );
477 foreach ( $result as $row ) {
478 $lb->add(
NS_USER, $row->ipb_address );
481 if ( $row->ipb_by ??
null ) {
482 $lb->add(
NS_USER, $row->ipb_by_text );
486 if ( !$row->ipb_sitewide ) {
487 $partialBlocks[] = $row->ipb_id;
491 if ( $partialBlocks ) {
494 $this->restrictions = $this->blockRestrictionStore->loadByBlockId( $partialBlocks );
496 foreach ( $this->restrictions as $restriction ) {
497 if ( $restriction->getType() === PageRestriction::TYPE ) {
498 '@phan-var PageRestriction $restriction';
499 $title = $restriction->getTitle();