r58377 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58376‎ | r58377 | r58378 >
Date:21:41, 30 October 2009
Author:demon
Status:resolved (Comments)
Tags:
Comment:
(bug 3340) Allow configuring of /16 limit on range blocks
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialBlockip.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/DefaultSettings.php
@@ -1271,6 +1271,7 @@
12721272 $wgAutoblockExpiry = 86400; # Number of seconds before autoblock entries expire
12731273 $wgBlockAllowsUTEdit = false; # Default setting for option on block form to allow self talkpage editing whilst blocked
12741274 $wgSysopEmailBans = true; # Allow sysops to ban users from accessing Emailuser
 1275+$wgBlockCIDRLimit = 16; # Blocks below the /16 set of IPs will not be allowed
12751276
12761277 # Pages anonymous user may see as an array, e.g.:
12771278 # array ( "Main Page", "Wikipedia:Help");
Index: trunk/phase3/includes/specials/SpecialBlockip.php
@@ -345,7 +345,7 @@
346346 * @return array(message key, arguments) on failure, empty array on success
347347 */
348348 function doBlock( &$userId = null, &$expiry = null ) {
349 - global $wgUser, $wgSysopUserBans, $wgSysopRangeBans, $wgBlockAllowsUTEdit;
 349+ global $wgUser, $wgSysopUserBans, $wgSysopRangeBans, $wgBlockAllowsUTEdit, $wgBlockCIDRLimit;
350350
351351 $userId = 0;
352352 # Expand valid IPv6 addresses, usernames are left as is
@@ -361,7 +361,7 @@
362362 if( preg_match( "/^($rxIP4)\\/(\\d{1,2})$/", $this->BlockAddress, $matches ) ) {
363363 # IPv4
364364 if( $wgSysopRangeBans ) {
365 - if( !IP::isIPv4( $this->BlockAddress ) || $matches[2] < 16 || $matches[2] > 32 ) {
 365+ if( !IP::isIPv4( $this->BlockAddress ) || $matches[2] < $wgBlockCIDRLimit || $matches[2] > 32 ) {
366366 return array( 'ip_range_invalid' );
367367 }
368368 $this->BlockAddress = Block::normaliseRange( $this->BlockAddress );
Index: trunk/phase3/RELEASE-NOTES
@@ -90,6 +90,8 @@
9191 * $wgCapitalLinkOverrides added to configure per-namespace capitalization
9292 * (bug 21172) $wgSorbsUrl can now be an array with multiple DNSBL
9393 * $wgEnableHtmlDiff has been removed
 94+* (bug 3340) $wgBlockCIDRLimit added (default: 16) to configure the low end of
 95+ CIDR ranges for blocking
9496
9597 === New features in 1.16 ===
9698

Follow-up revisions

RevisionCommit summaryAuthorDate
r60643Clarify comment on $wgBlockCIDRLimit, larger not below (r58377)tstarling05:08, 5 January 2010
r60644Split rangeblock error message, allow configuring max size of IPv6 blocks as ...overlordq05:44, 5 January 2010

Comments

#Comment by Tim Starling (talk | contribs)   05:10, 5 January 2010

Splitting the error message would be useful, since it can no longer be localised to say that blocks larger than /16 will be rejected. The error message should have $wgBlockCIDRLimit passed as a parameter.

#Comment by 😂 (talk | contribs)   10:03, 5 January 2010

Looks good from r60644.

Status & tagging log