r35907 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r35906‎ | r35907 | r35908 >
Date:02:48, 5 June 2008
Author:tstarling
Status:old
Tags:
Comment:
Add configuration variable $wgTorDisableAdminBlocks, allowing the disabling of admin blocks of tor nodes to be disabled. Removed duplicate definition of $wgTorIPs.
Modified paths:
  • /trunk/extensions/TorBlock/TorBlock.class.php (modified) (history)
  • /trunk/extensions/TorBlock/TorBlock.php (modified) (history)

Diff [purge]

Index: trunk/extensions/TorBlock/TorBlock.php
@@ -50,12 +50,6 @@
5151 $wgTorLoadNodes = true;
5252
5353 /**
54 - * What IPs people can access your site with.
55 - * Needed for checking against exit policies.
56 - */
57 -$wgTorIPs = array();
58 -
59 -/**
6054 * Actions tor users are allowed to do.
6155 * E.g. to allow account creation, add createaccount.
6256 */
@@ -73,3 +67,8 @@
7468 * (i.e. all IPs which can be used to access the site.
7569 */
7670 $wgTorIPs = array( '208.80.152.2' );
 71+
 72+/**
 73+ * Disable existing blocks of Tor nodes
 74+ */
 75+$wgTorDisableAdminBlocks = true;
Index: trunk/extensions/TorBlock/TorBlock.class.php
@@ -117,7 +117,8 @@
118118 }
119119
120120 public static function onGetBlockedStatus( &$user ) {
121 - if (self::isExitNode() && $user->mBlock && !$user->mBlock->mUser) {
 121+ global $wgTorDisableAdminBlocks;
 122+ if ($wgTorDisableAdminBlocks && self::isExitNode() && $user->mBlock && !$user->mBlock->mUser) {
122123 wfDebug( "User using Tor node. Disabling IP block as it was probably targetted at the tor node." );
123124 // Node is probably blocked for being a Tor node. Remove block.
124125 $user->mBlockedby = 0;
@@ -153,4 +154,4 @@
154155
155156 return true;
156157 }
157 -}
\ No newline at end of file
 158+}

Status & tagging log