MediaWiki REL1_37
|
A DatabaseBlock (unlike a SystemBlock) is stored in the database, may give rise to autoblocks and may be tracked with cookies. More...
Public Member Functions | ||||
__construct (array $options=[]) | ||||
Create a new block with specified option parameters on a user, IP or IP range. | ||||
appliesToNamespace ( $ns) | ||||
Checks if a block applies to a particular namespace.
| ||||
appliesToPage ( $pageId) | ||||
Checks if a block applies to a particular page.This check does not consider whether $this->isUsertalkEditAllowed returns false, as the identity of the user making the hypothetical edit isn't known here (particularly in the case of IP hardblocks, range blocks, and auto-blocks).
| ||||
appliesToRight ( $right) | ||||
Determine whether the block prevents a given right.A right may be allowed or disallowed by default, or determined from a property on the block object. For certain rights, the property may be overridden according to global configs.
| ||||
appliesToTitle (Title $title) | ||||
Checks if a block applies to a particular title.This check does not consider whether $this->isUsertalkEditAllowed returns false, as the identity of the user making the hypothetical edit isn't known here (particularly in the case of IP hardblocks, range blocks, and auto-blocks).
| ||||
delete () | ||||
Delete the row from the IP blocks table. | ||||
doAutoblock ( $autoblockIP) | ||||
Autoblocks the given IP, referring to this block. | ||||
equals (DatabaseBlock $block) | ||||
Check if two blocks are effectively equal. | ||||
getBlocker () | ||||
Get the user who implemented this block. | ||||
getBy () | ||||
Get the user id of the blocking sysop.
| ||||
getByName () | ||||
Get the username of the blocking sysop.
| ||||
getId () | ||||
Get the block ID.
| ||||
getIdentifier () | ||||
Get the information that identifies this block, such that a user could look up everything that can be found about this block.Typically a scalar ID (integer or string), but can also return a list of IDs, or an associative array encoding a composite ID. Must be safe to serialize as JSON.
| ||||
getParentBlockId () | ||||
getRangeEnd () | ||||
Get the IP address at the end of the range in Hex form. | ||||
getRangeStart () | ||||
Get the IP address at the start of the range in Hex form. | ||||
getRawRestrictions () | ||||
Get restrictions without loading from database if not yet loaded. | ||||
getReason () | ||||
Get the reason given for creating the block, as a string.Deprecated, since this gives the caller no control over the language or format, and no access to the comment's data.
| ||||
getRedactedName () | ||||
Get the block name, but with autoblocked IPs hidden as per standard privacy policy. | ||||
getRestrictions () | ||||
Getting the restrictions will perform a database query if the restrictions are not already loaded. | ||||
getType () | ||||
Get the type of target for this particular block.
| ||||
insert (IDatabase $dbw=null) | ||||
Insert a block into the block table. | ||||
isAutoblocking ( $x=null) | ||||
isExpired () | ||||
Has the block expired? | ||||
isHardblock ( $x=null) | ||||
Get/set whether the block is a hardblock (affects logged-in users on a given IP/range) | ||||
setBlocker ( $user) | ||||
Set the user who implemented (or will implement) this block. | ||||
setId ( $blockId) | ||||
Set the block ID. | ||||
setRestrictions (array $restrictions) | ||||
update () | ||||
Update a block in the DB with new parameters. | ||||
updateTimestamp () | ||||
Update the timestamp on autoblocks. | ||||
Public Member Functions inherited from MediaWiki\Block\AbstractBlock | ||||
appliesToPasswordReset () | ||||
Check if the block prevents a user from resetting their password. | ||||
appliesToUsertalk (Title $usertalk=null) | ||||
Determine whether the block allows the user to edit their own user talk page. | ||||
getExpiry () | ||||
Get the block expiry time. | ||||
getHideName () | ||||
Get whether the block hides the target's username. | ||||
getPermissionsError (IContextSource $context) | ||||
Get the key and parameters for the corresponding error message. | ||||
getReasonComment () | ||||
Get the reason for creating the block. | ||||
getTarget () | ||||
Get the target for this particular block. | ||||
getTargetAndType () | ||||
Get the target and target type for this particular block. | ||||
getTargetName () | ||||
getTargetUserIdentity () | ||||
getTimestamp () | ||||
Get the timestamp indicating when the block was created. | ||||
isBlocking ( $target) | ||||
isCreateAccountBlocked ( $x=null) | ||||
Get or set the flag indicating whether this block blocks the target from creating an account. | ||||
isEmailBlocked ( $x=null) | ||||
Get or set the flag indicating whether this block blocks the target from sending emails. | ||||
isSitewide ( $x=null) | ||||
Indicates that the block is a sitewide block. | ||||
isUsertalkEditAllowed ( $x=null) | ||||
Get or set the flag indicating whether this block blocks the target from editing their own user talk page. | ||||
setExpiry ( $expiry) | ||||
Set the block expiry time. | ||||
setHideName ( $hideName) | ||||
Set whether ths block hides the target's username. | ||||
setReason ( $reason) | ||||
Set the reason for creating the block. | ||||
setTarget ( $target) | ||||
Set the target for this block, and update $this->type accordingly. | ||||
setTimestamp ( $timestamp) | ||||
Set the timestamp indicating when the block was created. | ||||
Public Member Functions inherited from MediaWiki\Block\Block | ||||
isCreateAccountBlocked () | ||||
Get the flag indicating whether this block blocks the target from creating an account. | ||||
isHardblock () | ||||
Returns whether the block is a hardblock (affects logged-in users on a given IP/range) | ||||
isSitewide () | ||||
Indicates that the block is a sitewide block. | ||||
Static Public Member Functions | |
static | getAutoblockExpiry ( $timestamp) |
Get a timestamp of the expiry for autoblocks. | |
static | getBlocksForIPList (array $ipChain, $isAnon, $fromPrimary=false) |
Get all blocks that match any IP from an array of IP addresses. | |
static | getQueryInfo () |
Return the tables, fields, and join conditions to be selected to create a new block object. | |
static | getRangeCond ( $start, $end=null) |
Get a set of SQL conditions which will select rangeblocks encompassing a given range. | |
static | isExemptedFromAutoblocks ( $ip) |
Checks whether a given IP is on the autoblock exemption list. | |
static | isWhitelistedFromAutoblocks ( $ip) |
Checks whether a given IP is on the autoblock exemption list. | |
static | newFromID ( $id) |
Load a block from the block id. | |
static | newFromRow ( $row) |
Create a new DatabaseBlock object from a database row. | |
static | newFromTarget ( $specificTarget, $vagueTarget=null, $fromPrimary=false) |
Given a target and the target's type, get an existing block object if possible. | |
static | newListFromTarget ( $specificTarget, $vagueTarget=null, $fromPrimary=false) |
This is similar to DatabaseBlock::newFromTarget, but it returns all the relevant blocks. | |
static | purgeExpired () |
Purge expired blocks from the ipblocks table. | |
Public Attributes | |
bool | $mAuto |
int | $mParentBlockId |
Public Attributes inherited from MediaWiki\Block\AbstractBlock | |
string | $mExpiry = '' |
bool | $mHideName = false |
string | $mTimestamp = '' |
Public Attributes inherited from MediaWiki\Block\Block | |
const | TYPE_AUTO = 4 |
const | TYPE_ID = 5 |
const | TYPE_IP = 2 |
const | TYPE_RANGE = 3 |
const | TYPE_USER = 1 |
Protected Member Functions | |
initFromRow ( $row) | |
Given a database row from the ipblocks table, initialize member variables. | |
Static Protected Member Functions | |
static | chooseMostSpecificBlock (array $blocks) |
Choose the most specific block from some combination of user, IP and IP range blocks. | |
static | getIpFragment ( $hex) |
Get the component of an IP address which is certain to be the same between an IP address and a rangeblock containing that IP address. | |
static | newLoad ( $specificTarget, $specificType, $fromPrimary, $vagueTarget=null) |
Load blocks from the database which target the specific target exactly, or which cover the vague target. | |
Private Member Functions | |
findRestriction ( $type, $value) | |
Find Restriction by type and value. | |
getBlockRestrictionStore () | |
Get a BlockRestrictionStore instance. | |
Private Attributes | |
UserIdentity null | $blocker |
bool | $isAutoblocking |
bool | $mFromPrimary |
int | $mId |
Restriction[] | $restrictions |
Additional Inherited Members | |
Protected Attributes inherited from MediaWiki\Block\AbstractBlock | |
bool | $allowUsertalk = false |
bool | $blockCreateAccount = false |
bool | $isHardblock |
bool | $isSitewide = true |
bool | $mBlockEmail = false |
CommentStoreComment | $reason |
UserIdentity string null | $target |
int null | $type |
AbstractBlock::TYPE_ constant. | |
A DatabaseBlock (unlike a SystemBlock) is stored in the database, may give rise to autoblocks and may be tracked with cookies.
Such blocks are more customizable than system blocks: they may be hardblocks, and they may be sitewide or partial.
Definition at line 52 of file DatabaseBlock.php.
MediaWiki\Block\DatabaseBlock::__construct | ( | array | $options = [] | ) |
Create a new block with specified option parameters on a user, IP or IP range.
array | $options | Parameters of the block, with options supported by AbstractBlock::__construct , and also:
|
Reimplemented from MediaWiki\Block\AbstractBlock.
Definition at line 102 of file DatabaseBlock.php.
References DB_REPLICA, MediaWiki\MediaWikiServices\getInstance(), MediaWiki\Block\DatabaseBlock\isAutoblocking(), MediaWiki\Block\Block\isCreateAccountBlocked(), MediaWiki\Block\AbstractBlock\isEmailBlocked(), MediaWiki\Block\Block\isSitewide(), MediaWiki\Block\AbstractBlock\isUsertalkEditAllowed(), MediaWiki\Block\DatabaseBlock\setBlocker(), MediaWiki\Block\AbstractBlock\setExpiry(), wfDeprecatedMsg(), and wfGetDB().
MediaWiki\Block\DatabaseBlock::appliesToNamespace | ( | $ns | ) |
Checks if a block applies to a particular namespace.
int | $ns |
Reimplemented from MediaWiki\Block\AbstractBlock.
Definition at line 1083 of file DatabaseBlock.php.
MediaWiki\Block\DatabaseBlock::appliesToPage | ( | $pageId | ) |
Checks if a block applies to a particular page.This check does not consider whether $this->isUsertalkEditAllowed
returns false, as the identity of the user making the hypothetical edit isn't known here (particularly in the case of IP hardblocks, range blocks, and auto-blocks).
int | $pageId |
Reimplemented from MediaWiki\Block\AbstractBlock.
Definition at line 1101 of file DatabaseBlock.php.
MediaWiki\Block\DatabaseBlock::appliesToRight | ( | $right | ) |
Determine whether the block prevents a given right.A right may be allowed or disallowed by default, or determined from a property on the block object. For certain rights, the property may be overridden according to global configs.
string | $right |
Reimplemented from MediaWiki\Block\AbstractBlock.
Definition at line 1119 of file DatabaseBlock.php.
References $res.
MediaWiki\Block\DatabaseBlock::appliesToTitle | ( | Title | $title | ) |
Checks if a block applies to a particular title.This check does not consider whether $this->isUsertalkEditAllowed
returns false, as the identity of the user making the hypothetical edit isn't known here (particularly in the case of IP hardblocks, range blocks, and auto-blocks).
Title | $title |
Reimplemented from MediaWiki\Block\AbstractBlock.
Definition at line 1065 of file DatabaseBlock.php.
References $title.
|
staticprotected |
Choose the most specific block from some combination of user, IP and IP range blocks.
Decreasing order of specificity: user > IP > narrower IP range > wider IP range. A range that encompasses one IP address is ranked equally to a singe IP.
This is refactored out from DatabaseBlock::newLoad.
DatabaseBlock[] | $blocks | These should not include autoblocks or ID blocks |
Definition at line 372 of file DatabaseBlock.php.
References MediaWiki\Block\AbstractBlock\$target.
MediaWiki\Block\DatabaseBlock::delete | ( | ) |
Delete the row from the IP blocks table.
MWException |
Definition at line 510 of file DatabaseBlock.php.
References MediaWiki\MediaWikiServices\getInstance().
MediaWiki\Block\DatabaseBlock::doAutoblock | ( | $autoblockIP | ) |
Autoblocks the given IP, referring to this block.
string | $autoblockIP | The IP to autoblock. |
Definition at line 615 of file DatabaseBlock.php.
References MediaWiki\Block\DatabaseBlock\$mId, MediaWiki\Block\DatabaseBlock\getBlocker(), MediaWiki\Block\AbstractBlock\getExpiry(), MediaWiki\Block\AbstractBlock\getHideName(), MediaWiki\MediaWikiServices\getInstance(), MediaWiki\Block\AbstractBlock\getReasonComment(), MediaWiki\Block\DatabaseBlock\getRestrictions(), MediaWiki\Block\AbstractBlock\getTargetName(), MediaWiki\Block\DatabaseBlock\isAutoblocking(), MediaWiki\Block\Block\isCreateAccountBlocked(), MediaWiki\Block\Block\isSitewide(), MediaWiki\Block\AbstractBlock\isUsertalkEditAllowed(), MediaWiki\Block\DatabaseBlock\newFromTarget(), Hooks\runner(), wfDebug(), wfMessage(), and wfTimestampNow().
MediaWiki\Block\DatabaseBlock::equals | ( | DatabaseBlock | $block | ) |
Check if two blocks are effectively equal.
Doesn't check irrelevant things like the blocking user or the block timestamp, only things which affect the blocked user
DatabaseBlock | $block |
Definition at line 237 of file DatabaseBlock.php.
References MediaWiki\Block\AbstractBlock\getExpiry(), MediaWiki\Block\AbstractBlock\getHideName(), MediaWiki\Block\AbstractBlock\getReasonComment(), MediaWiki\Block\DatabaseBlock\getRestrictions(), MediaWiki\Block\DatabaseBlock\isAutoblocking(), MediaWiki\Block\AbstractBlock\isCreateAccountBlocked(), MediaWiki\Block\AbstractBlock\isEmailBlocked(), MediaWiki\Block\DatabaseBlock\isHardblock(), MediaWiki\Block\AbstractBlock\isSitewide(), and MediaWiki\Block\AbstractBlock\isUsertalkEditAllowed().
|
private |
Find Restriction by type and value.
string | $type | |
int | $value |
Definition at line 1152 of file DatabaseBlock.php.
References $type.
|
static |
Get a timestamp of the expiry for autoblocks.
string | int | $timestamp |
Definition at line 856 of file DatabaseBlock.php.
References $wgAutoblockExpiry, and wfTimestamp().
MediaWiki\Block\DatabaseBlock::getBlocker | ( | ) |
Get the user who implemented this block.
Implements MediaWiki\Block\Block.
Definition at line 1195 of file DatabaseBlock.php.
Referenced by MediaWiki\Block\DatabaseBlock\doAutoblock(), MediaWiki\Block\DatabaseBlockStore\insertBlock(), and MediaWiki\Block\DatabaseBlockStore\updateBlock().
|
private |
Get a BlockRestrictionStore instance.
Definition at line 1172 of file DatabaseBlock.php.
|
static |
Get all blocks that match any IP from an array of IP addresses.
array | $ipChain | List of IPs (strings), usually retrieved from the X-Forwarded-For header of the request |
bool | $isAnon | Exclude anonymous-only blocks if false |
bool | $fromPrimary | Whether to query the primary or replica DB |
Definition at line 940 of file DatabaseBlock.php.
References DB_PRIMARY, DB_REPLICA, LIST_OR, and wfGetDB().
Referenced by MediaWiki\Block\BlockManager\getAdditionalIpBlocks().
MediaWiki\Block\DatabaseBlock::getBy | ( | ) |
Get the user id of the blocking sysop.
Reimplemented from MediaWiki\Block\AbstractBlock.
Definition at line 1179 of file DatabaseBlock.php.
MediaWiki\Block\DatabaseBlock::getByName | ( | ) |
Get the username of the blocking sysop.
Reimplemented from MediaWiki\Block\AbstractBlock.
Definition at line 1186 of file DatabaseBlock.php.
MediaWiki\Block\DatabaseBlock::getId | ( | ) |
Get the block ID.
Reimplemented from MediaWiki\Block\AbstractBlock.
Definition at line 775 of file DatabaseBlock.php.
Referenced by MediaWiki\Block\BlockManager\getCookieValue(), MediaWiki\Block\DatabaseBlockStore\insertBlock(), MediaWiki\Block\BlockUser\log(), and MediaWiki\Block\DatabaseBlockStore\updateBlock().
MediaWiki\Block\DatabaseBlock::getIdentifier | ( | ) |
Get the information that identifies this block, such that a user could look up everything that can be found about this block.Typically a scalar ID (integer or string), but can also return a list of IDs, or an associative array encoding a composite ID. Must be safe to serialize as JSON.
Implements MediaWiki\Block\Block.
Definition at line 1015 of file DatabaseBlock.php.
|
staticprotected |
Get the component of an IP address which is certain to be the same between an IP address and a rangeblock containing that IP address.
string | $hex | Hexadecimal IP representation |
Definition at line 447 of file DatabaseBlock.php.
References $wgBlockCIDRLimit.
Referenced by MediaWiki\Block\DatabaseBlock\getRangeCond().
MediaWiki\Block\DatabaseBlock::getParentBlockId | ( | ) |
Definition at line 802 of file DatabaseBlock.php.
|
static |
Return the tables, fields, and join conditions to be selected to create a new block object.
Since 1.34, ipb_by and ipb_by_text have not been present in the database, but they continue to be available in query results as aliases.
$table
to IDatabase->select()
$vars
to IDatabase->select()
$join_conds
to IDatabase->select()
Definition at line 199 of file DatabaseBlock.php.
Referenced by MediaWiki\Block\DatabaseBlock\newFromID(), and MediaWiki\Block\DatabaseBlock\newLoad().
|
static |
Get a set of SQL conditions which will select rangeblocks encompassing a given range.
string | $start | Hexadecimal IP representation |
string | null | $end | Hexadecimal IP representation, or null to use $start = $end |
Definition at line 414 of file DatabaseBlock.php.
References $dbr, DB_REPLICA, MediaWiki\Block\DatabaseBlock\getIpFragment(), LIST_AND, and wfGetDB().
Referenced by MediaWiki\Block\DatabaseBlock\newLoad().
MediaWiki\Block\DatabaseBlock::getRangeEnd | ( | ) |
Get the IP address at the end of the range in Hex form.
MWException |
Definition at line 747 of file DatabaseBlock.php.
References MediaWiki\Block\Block\TYPE_IP, MediaWiki\Block\Block\TYPE_RANGE, and MediaWiki\Block\Block\TYPE_USER.
MediaWiki\Block\DatabaseBlock::getRangeStart | ( | ) |
Get the IP address at the start of the range in Hex form.
MWException |
Definition at line 728 of file DatabaseBlock.php.
References MediaWiki\Block\Block\TYPE_IP, MediaWiki\Block\Block\TYPE_RANGE, and MediaWiki\Block\Block\TYPE_USER.
MediaWiki\Block\DatabaseBlock::getRawRestrictions | ( | ) |
Get restrictions without loading from database if not yet loaded.
Definition at line 1045 of file DatabaseBlock.php.
Referenced by MediaWiki\Block\DatabaseBlockStore\insertBlock(), and MediaWiki\Block\DatabaseBlockStore\updateBlock().
MediaWiki\Block\DatabaseBlock::getReason | ( | ) |
Get the reason given for creating the block, as a string.Deprecated, since this gives the caller no control over the language or format, and no access to the comment's data.
Reimplemented from MediaWiki\Block\AbstractBlock.
Definition at line 765 of file DatabaseBlock.php.
References MediaWiki\Block\DatabaseBlock\getType().
MediaWiki\Block\DatabaseBlock::getRedactedName | ( | ) |
Get the block name, but with autoblocked IPs hidden as per standard privacy policy.
Definition at line 838 of file DatabaseBlock.php.
References wfMessage().
MediaWiki\Block\DatabaseBlock::getRestrictions | ( | ) |
Getting the restrictions will perform a database query if the restrictions are not already loaded.
Definition at line 1026 of file DatabaseBlock.php.
Referenced by MediaWiki\Block\DatabaseBlock\doAutoblock(), and MediaWiki\Block\DatabaseBlock\equals().
MediaWiki\Block\DatabaseBlock::getType | ( | ) |
Get the type of target for this particular block.
Autoblocks have whichever type corresponds to their target, so to detect if a block is an autoblock, we have to check the mAuto property instead.
Reimplemented from MediaWiki\Block\AbstractBlock.
Definition at line 1006 of file DatabaseBlock.php.
Referenced by MediaWiki\Block\DatabaseBlock\getReason(), SpecialBlock\maybeAlterFormDefaults(), and MediaWiki\Block\BlockManager\shouldApplyCookieBlock().
|
protected |
Given a database row from the ipblocks table, initialize member variables.
stdClass | $row | A row from the ipblocks table |
Definition at line 461 of file DatabaseBlock.php.
References DB_REPLICA, MediaWiki\MediaWikiServices\getInstance(), MediaWiki\Block\DatabaseBlock\isAutoblocking(), MediaWiki\Block\Block\isCreateAccountBlocked(), MediaWiki\Block\AbstractBlock\isEmailBlocked(), MediaWiki\Block\Block\isHardblock(), MediaWiki\Block\Block\isSitewide(), MediaWiki\Block\AbstractBlock\isUsertalkEditAllowed(), MediaWiki\Block\DatabaseBlock\setBlocker(), MediaWiki\Block\AbstractBlock\setExpiry(), MediaWiki\Block\AbstractBlock\setHideName(), MediaWiki\Block\AbstractBlock\setReason(), MediaWiki\Block\AbstractBlock\setTarget(), MediaWiki\Block\AbstractBlock\setTimestamp(), wfGetDB(), and wfTimestamp().
Referenced by MediaWiki\Block\DatabaseBlock\newFromRow().
MediaWiki\Block\DatabaseBlock::insert | ( | IDatabase | $dbw = null | ) |
Insert a block into the block table.
Will fail if there is a conflicting block (same name and options) already in the database.
IDatabase | null | $dbw | If you have one available |
Definition at line 525 of file DatabaseBlock.php.
References MediaWiki\MediaWikiServices\getInstance().
MediaWiki\Block\DatabaseBlock::isAutoblocking | ( | $x = null | ) |
null | bool | $x |
Definition at line 824 of file DatabaseBlock.php.
References wfSetVar().
Referenced by MediaWiki\Block\DatabaseBlock\__construct(), MediaWiki\Block\DatabaseBlock\doAutoblock(), MediaWiki\Block\DatabaseBlock\equals(), MediaWiki\Block\DatabaseBlock\initFromRow(), MediaWiki\Block\BlockManager\shouldApplyCookieBlock(), and MediaWiki\Block\DatabaseBlockStore\updateBlock().
|
static |
Checks whether a given IP is on the autoblock exemption list.
TODO: this probably belongs somewhere else, but not sure where...
string | $ip | The IP to check |
Definition at line 568 of file DatabaseBlock.php.
References $cache, $line, $lines, DB_REPLICA, MediaWiki\MediaWikiServices\getInstance(), wfDebug(), wfGetDB(), and wfMessage().
Referenced by MediaWiki\Block\DatabaseBlock\isWhitelistedFromAutoblocks().
MediaWiki\Block\DatabaseBlock::isExpired | ( | ) |
Has the block expired?
Definition at line 694 of file DatabaseBlock.php.
References MediaWiki\Block\AbstractBlock\getExpiry(), wfDebug(), and wfTimestampNow().
Referenced by MediaWiki\Block\BlockManager\shouldApplyCookieBlock().
MediaWiki\Block\DatabaseBlock::isHardblock | ( | $x = null | ) |
Get/set whether the block is a hardblock (affects logged-in users on a given IP/range)
bool | null | $x |
Reimplemented from MediaWiki\Block\AbstractBlock.
Definition at line 811 of file DatabaseBlock.php.
Referenced by MediaWiki\Block\DatabaseBlock\equals().
|
static |
Checks whether a given IP is on the autoblock exemption list.
string | $ip | The IP to check |
Definition at line 553 of file DatabaseBlock.php.
References MediaWiki\Block\DatabaseBlock\isExemptedFromAutoblocks(), and wfDeprecated().
|
static |
Load a block from the block id.
int | $id | id to search for |
Definition at line 167 of file DatabaseBlock.php.
References $dbr, $res, DB_REPLICA, MediaWiki\Block\DatabaseBlock\getQueryInfo(), MediaWiki\Block\DatabaseBlock\newFromRow(), and wfGetDB().
Referenced by MediaWiki\Block\BlockManager\getBlockFromCookieValue().
|
static |
Create a new DatabaseBlock object from a database row.
stdClass | $row | Row from the ipblocks table |
Definition at line 497 of file DatabaseBlock.php.
References MediaWiki\Block\DatabaseBlock\initFromRow().
Referenced by MediaWiki\Block\DatabaseBlock\newFromID(), and MediaWiki\Block\DatabaseBlock\newLoad().
|
static |
Given a target and the target's type, get an existing block object if possible.
string | UserIdentity | int | null | $specificTarget | A block target, which may be one of several types:
|
string | UserIdentity | int | null | $vagueTarget | As above, but we will search for any block which affects that target (so for an IP address, get ranges containing that IP; and also get any relevant autoblocks). Leave empty or blank to skip IP-based lookups. |
bool | $fromPrimary | Whether to use the DB_PRIMARY database |
Definition at line 891 of file DatabaseBlock.php.
Referenced by MediaWiki\Block\UnblockUser\__construct(), and MediaWiki\Block\DatabaseBlock\doAutoblock().
|
static |
This is similar to DatabaseBlock::newFromTarget, but it returns all the relevant blocks.
string | UserIdentity | int | null | $specificTarget | |
string | UserIdentity | int | null | $vagueTarget | |
bool | $fromPrimary |
Definition at line 905 of file DatabaseBlock.php.
References $type.
Referenced by MediaWiki\Block\BlockManager\getUserBlock().
|
staticprotected |
Load blocks from the database which target the specific target exactly, or which cover the vague target.
UserIdentity | string | null | $specificTarget | |
int | null | $specificType | |
bool | $fromPrimary | |
UserIdentity | string | null | $vagueTarget | Also search for blocks affecting this target. Doesn't make any sense to use TYPE_AUTO / TYPE_ID here. Leave blank to skip IP lookups. |
MWException |
Definition at line 271 of file DatabaseBlock.php.
References $res, MediaWiki\Block\AbstractBlock\$target, MediaWiki\Block\AbstractBlock\$type, DB_PRIMARY, DB_REPLICA, MediaWiki\MediaWikiServices\getInstance(), MediaWiki\Block\DatabaseBlock\getQueryInfo(), MediaWiki\Block\DatabaseBlock\getRangeCond(), LIST_OR, MediaWiki\Block\DatabaseBlock\newFromRow(), MediaWiki\Block\Block\TYPE_IP, MediaWiki\Block\Block\TYPE_RANGE, MediaWiki\Block\Block\TYPE_USER, and wfGetDB().
|
static |
Purge expired blocks from the ipblocks table.
Definition at line 867 of file DatabaseBlock.php.
MediaWiki\Block\DatabaseBlock::setBlocker | ( | $user | ) |
Set the user who implemented (or will implement) this block.
UserIdentity | string | $user | Local user object or username string. Calling with string is deprecated since 1.36 |
Definition at line 1205 of file DatabaseBlock.php.
References wfDeprecatedMsg().
Referenced by MediaWiki\Block\DatabaseBlock\__construct(), and MediaWiki\Block\DatabaseBlock\initFromRow().
MediaWiki\Block\DatabaseBlock::setId | ( | $blockId | ) |
Set the block ID.
int | $blockId |
Definition at line 786 of file DatabaseBlock.php.
Referenced by MediaWiki\Block\DatabaseBlockStore\insertBlock().
MediaWiki\Block\DatabaseBlock::setRestrictions | ( | array | $restrictions | ) |
Restriction[] | $restrictions |
Definition at line 1054 of file DatabaseBlock.php.
MediaWiki\Block\DatabaseBlock::update | ( | ) |
Update a block in the DB with new parameters.
The ID field needs to be loaded first.
Definition at line 539 of file DatabaseBlock.php.
References MediaWiki\MediaWikiServices\getInstance().
MediaWiki\Block\DatabaseBlock::updateTimestamp | ( | ) |
Update the timestamp on autoblocks.
Definition at line 704 of file DatabaseBlock.php.
References DB_PRIMARY, MediaWiki\Block\AbstractBlock\getTimestamp(), MediaWiki\Block\AbstractBlock\setExpiry(), MediaWiki\Block\AbstractBlock\setTimestamp(), wfGetDB(), and wfTimestamp().
|
private |
Definition at line 78 of file DatabaseBlock.php.
|
private |
Definition at line 72 of file DatabaseBlock.php.
bool MediaWiki\Block\DatabaseBlock::$mAuto |
Definition at line 57 of file DatabaseBlock.php.
|
private |
Definition at line 69 of file DatabaseBlock.php.
|
private |
Definition at line 66 of file DatabaseBlock.php.
Referenced by MediaWiki\Block\DatabaseBlock\doAutoblock().
int MediaWiki\Block\DatabaseBlock::$mParentBlockId |
Definition at line 63 of file DatabaseBlock.php.
|
private |
Definition at line 75 of file DatabaseBlock.php.