X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FBlock.php;h=301a45acd108214426cca5e32edba19ebd10eb27;hb=ea8032b078c18bd9fa93899513acfde3e4731116;hp=7cdc756303a23280449736c4a2154cb4d72dd3ad;hpb=a15243f15da7ef43b21dd24d77787c41d942ce75;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Block.php b/includes/Block.php index 7cdc756303..301a45acd1 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -126,17 +126,42 @@ class Block { $dbr = wfGetDB( DB_SLAVE ); $res = $dbr->selectRow( 'ipblocks', - '*', + self::selectFields(), array( 'ipb_id' => $id ), __METHOD__ ); if ( $res ) { - return Block::newFromRow( $res ); + return self::newFromRow( $res ); } else { return null; } } + /** + * Return the list of ipblocks fields that should be selected to create + * a new block. + * @return array + */ + public static function selectFields() { + return array( + 'ipb_id', + 'ipb_address', + 'ipb_by', + 'ipb_by_text', + 'ipb_reason', + 'ipb_timestamp', + 'ipb_auto', + 'ipb_anon_only', + 'ipb_create_account', + 'ipb_enable_autoblock', + 'ipb_expiry', + 'ipb_deleted', + 'ipb_block_email', + 'ipb_allow_usertalk', + 'ipb_parent_block_id', + ); + } + /** * 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 * @@ -247,7 +272,7 @@ class Block { } } - $res = $db->select( 'ipblocks', '*', $conds, __METHOD__ ); + $res = $db->select( 'ipblocks', self::selectFields(), $conds, __METHOD__ ); # This result could contain a block on the user, a block on the IP, and a russian-doll # set of rangeblocks. We want to choose the most specific one, so keep a leader board. @@ -260,7 +285,7 @@ class Block { $bestBlockPreventsEdit = null; foreach( $res as $row ){ - $block = Block::newFromRow( $row ); + $block = self::newFromRow( $row ); # Don't use expired blocks if( $block->deleteIfExpired() ){