MediaWiki fundraising/REL1_35
ApiBlockInfoTrait.php
Go to the documentation of this file.
1<?php
23
28
43 private function getBlockDetails(
44 AbstractBlock $block,
45 $language = null
46 ) {
47 if ( $language === null ) {
48 $language = $this->getLanguage();
49 }
50
51 $vals = [];
52 $vals['blockid'] = $block->getId();
53 $vals['blockedby'] = $block->getByName();
54 $vals['blockedbyid'] = $block->getBy();
55 $vals['blockreason'] = $block->getReasonComment()
56 ->message->inLanguage( $language )->plain();
57 $vals['blockedtimestamp'] = wfTimestamp( TS_ISO_8601, $block->getTimestamp() );
58 $vals['blockexpiry'] = ApiResult::formatExpiry( $block->getExpiry(), 'infinite' );
59 $vals['blockpartial'] = !$block->isSitewide();
60 if ( $block instanceof SystemBlock ) {
61 $vals['systemblocktype'] = $block->getSystemBlockType();
62 }
63 return $vals;
64 }
65
75 abstract public function getLanguage();
76
79}
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
getBy()
Get the user id of the blocking sysop.
getByName()
Get the username of the blocking sysop.
getTimestamp()
Get the timestamp indicating when the block was created.
getReasonComment()
Get the reason for creating the block.
isSitewide( $x=null)
Indicates that the block is a sitewide block.
getExpiry()
Get the block expiry time.
System blocks are temporary blocks that are created on enforcement (e.g.
trait ApiBlockInfoTrait