*
* @file
*/
+
+use MediaWiki\MediaWikiServices;
+
class Block {
/** @var string */
public $mReason;
public static function isWhitelistedFromAutoblocks( $ip ) {
// Try to get the autoblock_whitelist from the cache, as it's faster
// than getting the msg raw and explode()'ing it.
- $cache = ObjectCache::getMainWANInstance();
+ $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
$lines = $cache->getWithSetCallback(
wfMemcKey( 'ipb', 'autoblock', 'whitelist' ),
$cache::TTL_DAY,
- function () {
+ function ( $curValue, &$ttl, array &$setOpts ) {
+ $setOpts += Database::getCacheSetOptions( wfGetDB( DB_REPLICA ) );
+
return explode( "\n",
wfMessage( 'autoblock_whitelist' )->inContentLanguage()->plain() );
}
}
$conds = [];
+ $proxyLookup = MediaWikiServices::getInstance()->getProxyLookup();
foreach ( array_unique( $ipChain ) as $ipaddr ) {
# Discard invalid IP addresses. Since XFF can be spoofed and we do not
# necessarily trust the header given to us, make sure that we are only
continue;
}
# Don't check trusted IPs (includes local squids which will be in every request)
- if ( IP::isTrustedProxy( $ipaddr ) ) {
+ if ( $proxyLookup->isTrustedProxy( $ipaddr ) ) {
continue;
}
# Check both the original IP (to check against single blocks), as well as build