MediaWiki REL1_39
MediaWiki\Block\BlockUser Class Reference

Handles the backend logic of blocking users. More...

Public Member Functions

 __construct (ServiceOptions $options, BlockRestrictionStore $blockRestrictionStore, BlockPermissionCheckerFactory $blockPermissionCheckerFactory, BlockUtils $blockUtils, BlockActionInfo $blockActionInfo, HookContainer $hookContainer, DatabaseBlockStore $databaseBlockStore, UserFactory $userFactory, UserEditTracker $userEditTracker, LoggerInterface $logger, TitleFactory $titleFactory, $target, Authority $performer, string $expiry, string $reason, array $blockOptions, array $blockRestrictions, array $tags)
 
 placeBlock (bool $reblock=false)
 Places a block with checking permissions.
 
 placeBlockUnsafe (bool $reblock=false)
 Places a block without any sort of permissions checks.
 
 setLogDeletionFlags (int $flags)
 

Static Public Member Functions

static parseExpiryInput (string $expiry)
 Convert a submitted expiry time, which may be relative ("2 weeks", etc) or absolute ("24 May 2034", etc), into an absolute timestamp we can put into the database.
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 

Detailed Description

Handles the backend logic of blocking users.

Since
1.36

Definition at line 52 of file BlockUser.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Block\BlockUser::__construct ( ServiceOptions $options,
BlockRestrictionStore $blockRestrictionStore,
BlockPermissionCheckerFactory $blockPermissionCheckerFactory,
BlockUtils $blockUtils,
BlockActionInfo $blockActionInfo,
HookContainer $hookContainer,
DatabaseBlockStore $databaseBlockStore,
UserFactory $userFactory,
UserEditTracker $userEditTracker,
LoggerInterface $logger,
TitleFactory $titleFactory,
$target,
Authority $performer,
string $expiry,
string $reason,
array $blockOptions,
array $blockRestrictions,
array $tags )
Parameters
ServiceOptions$options
BlockRestrictionStore$blockRestrictionStore
BlockPermissionCheckerFactory$blockPermissionCheckerFactory
BlockUtils$blockUtils
BlockActionInfo$blockActionInfo
HookContainer$hookContainer
DatabaseBlockStore$databaseBlockStore
UserFactory$userFactory
UserEditTracker$userEditTracker
LoggerInterface$logger
TitleFactory$titleFactory
string | UserIdentity$targetTarget of the block
Authority$performerPerformer of the block
string$expiryExpiry of the block (timestamp or 'infinity')
string$reasonReason of the block
bool[]$blockOptionsValid options:
  • isCreateAccountBlocked : Are account creations prevented?
  • isEmailBlocked : Is emailing other users prevented?
  • isHardBlock : Are registered users prevented from editing?
  • isAutoblocking : Should this block spread to others to limit block evasion?
  • isUserTalkEditBlocked : Is editing blocked user's own talkpage allowed?
  • isHideUser : Should blocked user's name be hidden (needs hideuser)?
  • isPartial : Is this block partial? This is ignored when blockRestrictions is not an empty array.
array$blockRestrictions
string[]$tagsTags that should be assigned to the log entry

Definition at line 207 of file BlockUser.php.

References MediaWiki\Config\ServiceOptions\assertRequiredOptions(), MediaWiki\MainConfigNames\BlockAllowsUTEdit, MediaWiki\Block\BlockPermissionCheckerFactory\newBlockPermissionChecker(), NS_USER_TALK, MediaWiki\Block\BlockUser\parseExpiryInput(), and MediaWiki\Block\Block\TYPE_USER.

Member Function Documentation

◆ parseExpiryInput()

static MediaWiki\Block\BlockUser::parseExpiryInput ( string $expiry)
static

Convert a submitted expiry time, which may be relative ("2 weeks", etc) or absolute ("24 May 2034", etc), into an absolute timestamp we can put into the database.

Todo
strtotime() only accepts English strings. This means the expiry input can only be specified in English.
See also
https://www.php.net/manual/en/function.strtotime.php
Parameters
string$expiryWhatever was typed into the form
Returns
string|false Timestamp (format TS_MW) or 'infinity' or false on error.

Definition at line 336 of file BlockUser.php.

References wfIsInfinity(), and wfTimestamp().

Referenced by MediaWiki\Block\BlockUser\__construct().

◆ placeBlock()

MediaWiki\Block\BlockUser::placeBlock ( bool $reblock = false)

Places a block with checking permissions.

Parameters
bool$reblockShould this reblock?
Returns
Status If the block is successful, the value of the returned Status is an instance of a newly placed block.

Definition at line 414 of file BlockUser.php.

◆ placeBlockUnsafe()

MediaWiki\Block\BlockUser::placeBlockUnsafe ( bool $reblock = false)

Places a block without any sort of permissions checks.

Parameters
bool$reblockShould this reblock?
Returns
Status If the block is successful, the value of the returned Status is an instance of a newly placed block.

Definition at line 477 of file BlockUser.php.

◆ setLogDeletionFlags()

MediaWiki\Block\BlockUser::setLogDeletionFlags ( int $flags)
Stability: unstable
This method might be removed without prior notice (see T271101)
Parameters
int$flagsOne of LogPage::* constants

Definition at line 320 of file BlockUser.php.

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\Block\BlockUser::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const HideUserContribLimit
Name constant for the HideUserContribLimit setting, for use with Config::get()
const BlockAllowsUTEdit
Name constant for the BlockAllowsUTEdit setting, for use with Config::get()
Access: internal
For use by UserBlockCommandFactory

Definition at line 111 of file BlockUser.php.


The documentation for this class was generated from the following file: