MediaWiki r58377 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r58376‎ | r58377 (on ViewVC)‎ | 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:

Diff [purge]

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

Follow-up revisions

Rev.Commit 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 ^demon (Talk | contribs)   10:03, 5 January 2010

Looks good from r60644.

Status & tagging log

  • 10:03, 5 January 2010 ^demon (Talk | contribs) changed the status of r58377 [removed: fixme added: resolved]
  • 05:10, 5 January 2010 Tim Starling (Talk | contribs) changed the status of r58377 [removed: new added: fixme]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox