| [ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Source view] [Print] [Project Stats]
(no description)
| File Size: | 1387 lines (40 kb) |
| Included or required: | 0 times |
| Referenced: | 1 time |
| Includes or requires: | 0 files |
Block:: (46 methods):
__construct()
newFromID()
selectFields()
equals()
newLoad()
getRangeCond()
getIpFragment()
initFromRow()
newFromRow()
delete()
insert()
update()
getDatabaseArray()
getAutoblockUpdateArray()
doRetroactiveAutoblock()
defaultRetroactiveAutoblock()
isWhitelistedFromAutoblocks()
doAutoblock()
deleteIfExpired()
isExpired()
isValid()
updateTimestamp()
getRangeStart()
getRangeEnd()
getBy()
getByName()
getId()
fromMaster()
isHardblock()
isAutoblocking()
prevents()
getRedactedName()
getAutoblockExpiry()
purgeExpired()
newFromTarget()
getBlocksForIPList()
chooseBlock()
parseTarget()
getType()
getTargetAndType()
getTarget()
getExpiry()
setTarget()
getBlocker()
setBlocker()
getPermissionsError()
| __construct( $address = '', $user = 0, $by = 0, $reason = '',$timestamp = 0, $auto = 0, $expiry = '', $anonOnly = 0, $createAccount = 0, $enableAutoblock = 0,$hideName = 0, $blockEmail = 0, $allowUsertalk = 0, $byText = '') X-Ref |
param: string $address param: int $user param: int $by param: string $reason param: mixed $timestamp param: int $auto param: string $expiry param: int $anonOnly param: int $createAccount param: int $enableAutoblock param: int $hideName param: int $blockEmail param: int $allowUsertalk param: string $byText |
| newFromID( $id ) X-Ref |
| Load a blocked user from their block id. param: int $id Block id to search for return: Block|null |
| selectFields() X-Ref |
| Return the list of ipblocks fields that should be selected to create a new block. return: array |
| equals( Block $block ) X-Ref |
| 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 param: Block $block return: bool |
| newLoad( $vagueTarget = null ) X-Ref |
| Load a block from the database which affects the already-set $this->target: 1) A block directly on the given user or IP 2) A rangeblock encompassing the given IP (smallest first) 3) An autoblock on the given IP param: User|string $vagueTarget Also search for blocks affecting this target. Doesn't return: bool Whether a relevant block was found |
| getRangeCond( $start, $end = null ) X-Ref |
| Get a set of SQL conditions which will select rangeblocks encompassing a given range param: string $start Hexadecimal IP representation param: string $end Hexadecimal IP representation, or null to use $start = $end return: string |
| getIpFragment( $hex ) X-Ref |
| 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. param: string $hex Hexadecimal IP representation return: string |
| initFromRow( $row ) X-Ref |
| Given a database row from the ipblocks table, initialize member variables param: stdClass $row A row from the ipblocks table |
| newFromRow( $row ) X-Ref |
| Create a new Block object from a database row param: stdClass $row Row from the ipblocks table return: Block |
| delete() X-Ref |
| Delete the row from the IP blocks table. return: bool |
| insert( $dbw = null ) X-Ref |
| Insert a block into the block table. Will fail if there is a conflicting block (same name and options) already in the database. param: DatabaseBase $dbw If you have one available return: bool|array False on failure, assoc array on success: |
| update() X-Ref |
| Update a block in the DB with new parameters. The ID field needs to be loaded first. return: bool|array False on failure, array on success: |
| getDatabaseArray( $db = null ) X-Ref |
| Get an array suitable for passing to $dbw->insert() or $dbw->update() param: DatabaseBase $db return: array |
| getAutoblockUpdateArray() X-Ref |
return: array |
| doRetroactiveAutoblock() X-Ref |
| Retroactively autoblocks the last IP used by the user (if it is a user) blocked by this Block. return: array Block IDs of retroactive autoblocks made |
| defaultRetroactiveAutoblock( Block $block, array &$blockIds ) X-Ref |
| Retroactively autoblocks the last IP used by the user (if it is a user) blocked by this Block. This will use the recentchanges table. param: Block $block param: array &$blockIds |
| isWhitelistedFromAutoblocks( $ip ) X-Ref |
| Checks whether a given IP is on the autoblock whitelist. TODO: this probably belongs somewhere else, but not sure where... param: string $ip The IP to check return: bool |
| doAutoblock( $autoblockIP ) X-Ref |
| Autoblocks the given IP, referring to this Block. param: string $autoblockIP The IP to autoblock. return: int|bool Block ID if an autoblock was inserted, false if not. |
| deleteIfExpired() X-Ref |
| Check if a block has expired. Delete it if it is. return: bool |
| isExpired() X-Ref |
| Has the block expired? return: bool |
| isValid() X-Ref |
| Is the block address valid (i.e. not a null string?) return: bool |
| updateTimestamp() X-Ref |
| Update the timestamp on autoblocks. |
| getRangeStart() X-Ref |
| Get the IP address at the start of the range in Hex form return: string IP in Hex form |
| getRangeEnd() X-Ref |
| Get the IP address at the end of the range in Hex form return: string IP in Hex form |
| getBy() X-Ref |
| Get the user id of the blocking sysop return: int (0 for foreign users) |
| getByName() X-Ref |
| Get the username of the blocking sysop return: string |
| getId() X-Ref |
| Get the block ID return: int |
| fromMaster( $x = null ) X-Ref |
| Get/set a flag determining whether the master is used for reads param: bool $x return: bool |
| isHardblock( $x = null ) X-Ref |
| Get/set whether the Block is a hardblock (affects logged-in users on a given IP/range param: bool $x return: bool |
| isAutoblocking( $x = null ) X-Ref |
| No description |
| prevents( $action, $x = null ) X-Ref |
| Get/set whether the Block prevents a given action param: string $action param: bool $x return: bool |
| getRedactedName() X-Ref |
| Get the block name, but with autoblocked IPs hidden as per standard privacy policy return: string Text is escaped |
| getAutoblockExpiry( $timestamp ) X-Ref |
| Get a timestamp of the expiry for autoblocks param: string|int $timestamp return: string |
| purgeExpired() X-Ref |
| Purge expired blocks from the ipblocks table |
| newFromTarget( $specificTarget, $vagueTarget = null, $fromMaster = false ) X-Ref |
| Given a target and the target's type, get an existing Block object if possible. param: string|User|int $specificTarget A block target, which may be one of several types: param: string|User|int $vagueTarget As above, but we will search for *any* block which param: bool $fromMaster Whether to use the DB_MASTER database return: Block|null (null if no relevant block could be found). The target and type |
| getBlocksForIPList( array $ipChain, $isAnon, $fromMaster = false ) X-Ref |
| Get all blocks that match any IP from an array of IP addresses param: array $ipChain List of IPs (strings), usually retrieved from the param: bool $isAnon Exclude anonymous-only blocks if false param: bool $fromMaster Whether to query the master or slave database return: array Array of Blocks |
| chooseBlock( array $blocks, array $ipChain ) X-Ref |
| From a list of multiple blocks, find the most exact and strongest Block. The logic for finding the "best" block is: - Blocks that match the block's target IP are preferred over ones in a range - Hardblocks are chosen over softblocks that prevent account creation - Softblocks that prevent account creation are chosen over other softblocks - Other softblocks are chosen over autoblocks - If there are multiple exact or range blocks at the same level, the one chosen is random param: array $blocks Array of blocks param: array $ipChain List of IPs (strings). This is used to determine how "close" return: Block|null The "best" block from the list |
| parseTarget( $target ) X-Ref |
| From an existing Block, get the target and the type of target. Note that, except for null, it is always safe to treat the target as a string; for User objects this will return User::__toString() which in turn gives User::getName(). param: string|int|User|null $target return: array( User|String|null, Block::TYPE_ constant|null ) |
| getType() X-Ref |
| Get the type of target for this particular block return: int Block::TYPE_ constant, will never be TYPE_ID |
| getTargetAndType() X-Ref |
| Get the target and target type for this particular Block. Note that for autoblocks, this returns the unredacted name; frontend functions need to call $block->getRedactedName() in this situation. return: array( User|String, Block::TYPE_ constant ) |
| getTarget() X-Ref |
| Get the target for this particular Block. Note that for autoblocks, this returns the unredacted name; frontend functions need to call $block->getRedactedName() in this situation. return: User|string |
| getExpiry() X-Ref |
return: mixed|string |
| setTarget( $target ) X-Ref |
| Set the target for this block, and update $this->type accordingly param: mixed $target |
| getBlocker() X-Ref |
| Get the user who implemented this block return: User|string Local User object or string for a foreign user |
| setBlocker( $user ) X-Ref |
| Set the user who implemented (or will implement) this block param: User|string $user Local User object or username string for foreign users |
| getPermissionsError( IContextSource $context ) X-Ref |
| Get the key and parameters for the corresponding error message. param: IContextSource $context return: array |
| Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |