X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FBlock.php;h=134ee6be96f1f9a39426c04d2dc5ef28993533e5;hb=0909973197d2f4f73837169e14326696b5f4e76b;hp=5881353a0c04e0865e6a6edf37d3a9e66450eb8a;hpb=1aad5d4bf7c0bb72fc59de00a6c8998f37abde4b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Block.php b/includes/Block.php index 5881353a0c..134ee6be96 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -80,6 +80,20 @@ class Block { /** * @todo FIXME: Don't know what the best format to have for this constructor * is, but fourteen optional parameters certainly isn't it. + * @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 */ function __construct( $address = '', $user = 0, $by = 0, $reason = '', $timestamp = 0, $auto = 0, $expiry = '', $anonOnly = 0, $createAccount = 0, $enableAutoblock = 0, @@ -582,7 +596,6 @@ class Block { * * @param Block $block * @param array &$blockIds - * @return array Block IDs of retroactive autoblocks made */ protected static function defaultRetroactiveAutoblock( Block $block, array &$blockIds ) { global $wgPutIPinRC; @@ -872,7 +885,7 @@ class Block { /** * Get/set a flag determining whether the master is used for reads * - * @param bool $x + * @param bool|null $x * @return bool */ public function fromMaster( $x = null ) { @@ -881,7 +894,7 @@ class Block { /** * Get/set whether the Block is a hardblock (affects logged-in users on a given IP/range - * @param bool $x + * @param bool|null $x * @return bool */ public function isHardblock( $x = null ) { @@ -893,6 +906,10 @@ class Block { : $this->isHardblock; } + /** + * @param null|bool $x + * @return bool + */ public function isAutoblocking( $x = null ) { wfSetVar( $this->isAutoblocking, $x ); @@ -906,7 +923,7 @@ class Block { /** * Get/set whether the Block prevents a given action * @param string $action - * @param bool $x + * @param bool|null $x * @return bool */ public function prevents( $action, $x = null ) { @@ -1097,6 +1114,7 @@ class Block { /** * 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 @@ -1104,12 +1122,15 @@ class Block { * - Other softblocks are chosen over autoblocks * - If there are multiple exact or range blocks at the same level, the one chosen * is random + * This should be used when $blocks where retrieved from the user's IP address + * and $ipChain is populated from the same IP address information. * - * @param array $blocks Array of blocks + * @param array $blocks Array of Block objects * @param array $ipChain List of IPs (strings). This is used to determine how "close" * a block is to the server, and if a block matches exactly, or is in a range. * The order is furthest from the server to nearest e.g., (Browser, proxy1, proxy2, * local-squid, ...) + * @throws MWException * @return Block|null The "best" block from the list */ public static function chooseBlock( array $blocks, array $ipChain ) { @@ -1143,6 +1164,7 @@ class Block { ); $ipChain = array_reverse( $ipChain ); + /** @var Block $block */ foreach ( $blocks as $block ) { // Stop searching if we have already have a "better" block. This // is why the order of the blocks matters