Page MenuHomePhabricator

7883a.patch

Authored By
bzimport
Nov 21 2014, 9:27 PM
Size
2 KB
Referenced Files
None
Subscribers
None

7883a.patch

Index: includes/Block.php
===================================================================
--- includes/Block.php (revision 17592)
+++ includes/Block.php (working copy)
@@ -434,10 +434,12 @@
/**
* Autoblocks the given IP, referring to this Block.
- *@param $autoblockip The IP to autoblock.
- *@return Whether or not an autoblock was inserted.
+ * @param string $autoblockip The IP to autoblock.
+ * @return bool Whether or not an autoblock was inserted.
*/
function doAutoblock( $autoblockip ) {
+ global $wgAutoblockWhitelist;
+
# Check if this IP address is already blocked
$dbw =& wfGetDb( DB_MASTER );
$dbw->begin();
@@ -445,6 +447,14 @@
if ( !$this->mEnableAutoblock ) {
return;
}
+
+ $unsignedip = IP::toUnsigned($autoblockip);
+ foreach ($wgAutoblockWhitelist as $range) {
+ $range = IP::parseCIDR($range);
+ $bits = 32 - $range[1];
+ if ($range && $unsignedip >> $bits << $bits == $range[0])
+ return;
+ }
$ipblock = Block::newFromDB( $autoblockip );
if ( $ipblock ) {
Index: includes/DefaultSettings.php
===================================================================
--- includes/DefaultSettings.php (revision 17593)
+++ includes/DefaultSettings.php (working copy)
@@ -859,6 +859,11 @@
$wgSysopRangeBans = true; # Allow sysops to ban IP ranges
$wgAutoblockExpiry = 86400; # Number of seconds before autoblock entries expire
$wgBlockAllowsUTEdit = false; # Blocks allow users to edit their own user talk page
+# Dynamic AOL IPs are almost never used by the same person twice in a row, so
+# there's no point in autoblocking them. These are from
+# <http://webmaster.info.aol.com/proxyinfo.html>, but others may be added if
+# desired.
+$wgAutoblockWhitelist = array( '64.12.96.0/19', '149.174.160.0/20', '152.163.240.0/21', '152.163.248.0/22', '152.163.252.0/23', '152.163.96.0/22', '152.163.100.0/23', '195.93.32.0/22', '195.93.48.0/22', '195.93.64.0/19', '195.93.96.0/19', '195.93.16.0/20', '198.81.0.0/22', '198.81.16.0/20', '198.81.8.0/23', '202.67.64.128/25', '205.188.192.0/20', '205.188.208.0/23', '205.188.112.0/20', '205.188.146.144/30', '207.200.112.0/21' );
# Pages anonymous user may see as an array, e.g.:
# array ( "Main Page", "Special:Userlogin", "Wikipedia:Help");

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2916
Default Alt Text
7883a.patch (2 KB)

Event Timeline