Page MenuHomeWickedGov Phorge

UserBlockTarget.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

UserBlockTarget.php

<?php
namespace MediaWiki\Block;
use MediaWiki\Page\PageReference;
use MediaWiki\Page\PageReferenceValue;
use MediaWiki\User\UserIdentity;
use StatusValue;
/**
* A block target for a registered user
*
* @since 1.44
*/
class UserBlockTarget extends BlockTarget implements BlockTargetWithUserPage {
private UserIdentity $userIdentity;
public function __construct( UserIdentity $userIdentity ) {
parent::__construct( $userIdentity->getWikiId() );
$this->userIdentity = $userIdentity;
}
public function toString(): string {
return $this->userIdentity->getName();
}
public function getType(): int {
return Block::TYPE_USER;
}
public function getSpecificity() {
return 1;
}
public function getLogPage(): PageReference {
return $this->getUserPage();
}
public function getUserPage(): PageReference {
return new PageReferenceValue( NS_USER, $this->userIdentity->getName(), $this->wikiId );
}
public function getUserIdentity(): UserIdentity {
return $this->userIdentity;
}
public function validateForCreation(): StatusValue {
if ( !$this->userIdentity->isRegistered() ) {
return StatusValue::newFatal(
'nosuchusershort',
wfEscapeWikiText( $this->userIdentity->getName() )
);
}
return StatusValue::newGood();
}
protected function getLegacyUnion() {
return $this->getUserIdentity();
}
}

File Metadata

Mime Type
text/x-php
Expires
Wed, Aug 19, 12:27 (3 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ff/cf/d12c921ba2f0400ad020d04d8913
Default Alt Text
UserBlockTarget.php (1 KB)

Event Timeline