X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FBlock.php;h=4729f50cedf9ea56c92438c42df20c3762ac81f3;hb=9d9467c3a8ef2aff3c0bdfc916603232b6a2e200;hp=c5a16fcea6dc8ee4bff54c66258e63cfb4b4fde7;hpb=195f7096c77a13638f4443ef9c6e67f79cdb5d31;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Block.php b/includes/Block.php index c5a16fcea6..4729f50ced 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -308,8 +308,8 @@ class Block { if ( $block->getType() == self::TYPE_RANGE ) { # This is the number of bits that are allowed to vary in the block, give # or take some floating point errors - $end = wfBaseconvert( $block->getRangeEnd(), 16, 10 ); - $start = wfBaseconvert( $block->getRangeStart(), 16, 10 ); + $end = Wikimedia\base_convert( $block->getRangeEnd(), 16, 10 ); + $start = Wikimedia\base_convert( $block->getRangeStart(), 16, 10 ); $size = log( $end - $start + 1, 2 ); # This has the nice property that a /32 block is ranked equally with a @@ -452,7 +452,7 @@ class Block { * 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 + * @param IDatabase $dbw If you have one available * @return bool|array False on failure, assoc array on success: * ('id' => block ID, 'autoIds' => array of autoblock IDs) */ @@ -556,7 +556,7 @@ class Block { /** * Get an array suitable for passing to $dbw->insert() or $dbw->update() - * @param DatabaseBase $db + * @param IDatabase $db * @return array */ protected function getDatabaseArray( $db = null ) { @@ -679,16 +679,17 @@ class Block { * @return bool */ public static function isWhitelistedFromAutoblocks( $ip ) { - global $wgMemc; - // Try to get the autoblock_whitelist from the cache, as it's faster // than getting the msg raw and explode()'ing it. - $key = wfMemcKey( 'ipb', 'autoblock', 'whitelist' ); - $lines = $wgMemc->get( $key ); - if ( !$lines ) { - $lines = explode( "\n", wfMessage( 'autoblock_whitelist' )->inContentLanguage()->plain() ); - $wgMemc->set( $key, $lines, 3600 * 24 ); - } + $cache = ObjectCache::getMainWANInstance(); + $lines = $cache->getWithSetCallback( + wfMemcKey( 'ipb', 'autoblock', 'whitelist' ), + $cache::TTL_DAY, + function () { + return explode( "\n", + wfMessage( 'autoblock_whitelist' )->inContentLanguage()->plain() ); + } + ); wfDebug( "Checking the autoblock whitelist..\n" );