Handles the backend logic of blocking users.
More...
|
| __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) |
| Place a block, checking permissions.
|
|
| placeBlockUnsafe (bool $reblock=false) |
| Place a block without any sort of permissions checks.
|
|
| setLogDeletionFlags (int $flags) |
|
|
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.
|
|
Handles the backend logic of blocking users.
- Since
- 1.36
Definition at line 54 of file BlockUser.php.
◆ __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 | $target | Target of the block |
Authority | $performer | Performer of the block |
string | $expiry | Expiry of the block (timestamp or 'infinity') |
string | $reason | Reason of the block |
bool[] | $blockOptions | Valid options:
- isCreateAccountBlocked : Are account creations prevented?
- isEmailBlocked : Is emailing other users prevented?
- isHardBlock : Are named (non-temporary) users prevented from editing?
- isAutoblocking : Should this block spread to others to limit block evasion?
- isUserTalkEditBlocked : Is editing blocked user's own talk page prevented?
- 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.
|
AbstractRestriction[] | $blockRestrictions | |
string[] | $tags | Tags that should be assigned to the log entry |
Definition at line 188 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.
◆ 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 | $expiry | Whatever was typed into the form |
- Returns
- string|false Timestamp (format TS_MW) or 'infinity' or false on error.
Definition at line 310 of file BlockUser.php.
Referenced by MediaWiki\Block\BlockUser\__construct().
◆ placeBlock()
MediaWiki\Block\BlockUser::placeBlock |
( |
bool | $reblock = false | ) |
|
Place a block, checking permissions.
- Parameters
-
bool | $reblock | Should 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 381 of file BlockUser.php.
◆ placeBlockUnsafe()
MediaWiki\Block\BlockUser::placeBlockUnsafe |
( |
bool | $reblock = false | ) |
|
Place a block without any sort of permissions checks.
- Parameters
-
bool | $reblock | Should 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 449 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 | $flags | One of LogPage::* constants |
Definition at line 294 of file BlockUser.php.
◆ 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 92 of file BlockUser.php.
The documentation for this class was generated from the following file: