'Maintenance script', // Maintenance scripts which perform editing, image import script
'Template namespace initialisation script', // Used in 1.2->1.3 upgrade
'ScriptImporter', // Default user name used by maintenance/importSiteScripts.php
+ 'Unknown user', // Used in WikiImporter when importing revisions with no author
'msg:double-redirect-fixer', // Automatic double redirect fix
'msg:usermessage-editor', // Default user for leaving user messages
'msg:proxyblocker', // For $wgProxyList and Special:Blockme (removed in 1.22)
];
/**
- * Array of IPs which should be excluded from rate limits.
+ * Array of IPs / CIDR ranges which should be excluded from rate limits.
* This may be useful for whitelisting NAT gateways for conferences, etc.
*/
$wgRateLimitsExcludedIPs = [];
}
/**
- * Bug 37963
+ * T39963
* Make sure defaults are loaded when setOption is called.
* @covers User::loadOptions
*/
// Clean up.
$block->delete();
}
+
+ public function testIsPingLimitable() {
+ $request = new FauxRequest();
+ $request->setIP( '1.2.3.4' );
+ $user = User::newFromSession( $request );
+
+ $this->setMwGlobals( 'wgRateLimitsExcludedIPs', [] );
+ $this->assertTrue( $user->isPingLimitable() );
+
+ $this->setMwGlobals( 'wgRateLimitsExcludedIPs', [ '1.2.3.4' ] );
+ $this->assertFalse( $user->isPingLimitable() );
+
+ $this->setMwGlobals( 'wgRateLimitsExcludedIPs', [ '1.2.3.0/8' ] );
+ $this->assertFalse( $user->isPingLimitable() );
+
+ $this->setMwGlobals( 'wgRateLimitsExcludedIPs', [] );
+ $noRateLimitUser = $this->getMockBuilder( User::class )->disableOriginalConstructor()
+ ->setMethods( [ 'getIP', 'getRights' ] )->getMock();
+ $noRateLimitUser->expects( $this->any() )->method( 'getIP' )->willReturn( '1.2.3.4' );
+ $noRateLimitUser->expects( $this->any() )->method( 'getRights' )->willReturn( [ 'noratelimit' ] );
+ $this->assertFalse( $noRateLimitUser->isPingLimitable() );
+ }
}