MediaWiki  1.34.0
ApiBlockInfoTrait.php
Go to the documentation of this file.
1 <?php
23 
27 trait ApiBlockInfoTrait {
28 
41  private function getBlockDetails( AbstractBlock $block ) {
42  $vals = [];
43  $vals['blockid'] = $block->getId();
44  $vals['blockedby'] = $block->getByName();
45  $vals['blockedbyid'] = $block->getBy();
46  $vals['blockreason'] = $block->getReason();
47  $vals['blockedtimestamp'] = wfTimestamp( TS_ISO_8601, $block->getTimestamp() );
48  $vals['blockexpiry'] = ApiResult::formatExpiry( $block->getExpiry(), 'infinite' );
49  $vals['blockpartial'] = !$block->isSitewide();
50  if ( $block instanceof SystemBlock ) {
51  $vals['systemblocktype'] = $block->getSystemBlockType();
52  }
53  return $vals;
54  }
55 
56 }
MediaWiki\Block\AbstractBlock\getBy
getBy()
Get the user id of the blocking sysop.
Definition: AbstractBlock.php:133
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:1869
MediaWiki\Block\AbstractBlock\getId
getId()
Get the block ID.
Definition: AbstractBlock.php:150
MediaWiki\Block\AbstractBlock\isSitewide
isSitewide( $x=null)
Indicates that the block is a sitewide block.
Definition: AbstractBlock.php:203
MediaWiki\Block\SystemBlock
System blocks are temporary blocks that are created on enforcement (e.g.
Definition: SystemBlock.php:35
MediaWiki\Block\AbstractBlock\getExpiry
getExpiry()
Get the block expiry time.
Definition: AbstractBlock.php:450
MediaWiki\Block\AbstractBlock\getTimestamp
getTimestamp()
Get the timestamp indicating when the block was created.
Definition: AbstractBlock.php:470
ApiResult\formatExpiry
static formatExpiry( $expiry, $infinity='infinity')
Format an expiry timestamp for API output.
Definition: ApiResult.php:1205
MediaWiki\Block\AbstractBlock
Definition: AbstractBlock.php:34
MediaWiki\Block\AbstractBlock\getByName
getByName()
Get the username of the blocking sysop.
Definition: AbstractBlock.php:142
MediaWiki\Block\AbstractBlock\getReason
getReason()
Get the reason given for creating the block.
Definition: AbstractBlock.php:160