https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114117
Revision: 114117
Author: ialex
Date: 2012-03-18 22:19:00 +0000 (Sun, 18 Mar 2012)
Log Message:
-----------
* (bug 35303) Make proxy and DNS blacklist blocking work again
Modified Paths:
--------------
branches/REL1_19/phase3/RELEASE-NOTES-1.19
branches/REL1_19/phase3/includes/User.php
trunk/phase3/RELEASE-NOTES-1.19
trunk/phase3/includes/User.php
Modified: branches/REL1_19/phase3/RELEASE-NOTES-1.19
===================================================================
--- branches/REL1_19/phase3/RELEASE-NOTES-1.19 2012-03-18 22:13:55 UTC (rev
114116)
+++ branches/REL1_19/phase3/RELEASE-NOTES-1.19 2012-03-18 22:19:00 UTC (rev
114117)
@@ -24,6 +24,7 @@
preloaded into edit summary on section edit
* (bug 31417) New ID mw-content-text around the actual page text, without
categories,
contentSub, ... The same div often also contains the class
mw-content-ltr/rtl.
+* (bug 35303) Proxy and DNS blacklist blocking works again
=== Configuration changes in 1.19 ===
* Removed SkinTemplateSetupPageCss hook; use BeforePageDisplay instead.
Modified: branches/REL1_19/phase3/includes/User.php
===================================================================
--- branches/REL1_19/phase3/includes/User.php 2012-03-18 22:13:55 UTC (rev
114116)
+++ branches/REL1_19/phase3/includes/User.php 2012-03-18 22:19:00 UTC (rev
114117)
@@ -1268,10 +1268,6 @@
// overwriting mBlockedby, surely?
$this->load();
- $this->mBlockedby = 0;
- $this->mHideName = 0;
- $this->mAllowUsertalk = 0;
-
# We only need to worry about passing the IP address to the
Block generator if the
# user is not immune to autoblocks/hardblocks, and they are the
current user so we
# know which IP address they're actually coming from
@@ -1282,30 +1278,37 @@
}
# User/IP blocking
- $this->mBlock = Block::newFromTarget( $this->getName(), $ip,
!$bFromSlave );
- if ( $this->mBlock instanceof Block ) {
- wfDebug( __METHOD__ . ": Found block.\n" );
- $this->mBlockedby = $this->mBlock->getByName();
- $this->mBlockreason = $this->mBlock->mReason;
- $this->mHideName = $this->mBlock->mHideName;
- $this->mAllowUsertalk = !$this->mBlock->prevents(
'editownusertalk' );
- }
+ $block = Block::newFromTarget( $this->getName(), $ip,
!$bFromSlave );
# Proxy blocking
- if ( $ip !== null && !$this->isAllowed( 'proxyunbannable' ) &&
!in_array( $ip, $wgProxyWhitelist ) ) {
+ if ( !$block instanceof Block && $ip !== null &&
!$this->isAllowed( 'proxyunbannable' )
+ && !in_array( $ip, $wgProxyWhitelist ) )
+ {
# Local list
if ( self::isLocallyBlockedProxy( $ip ) ) {
- $this->mBlockedby = wfMsg( 'proxyblocker' );
- $this->mBlockreason = wfMsg( 'proxyblockreason'
);
+ $block = new Block;
+ $block->setBlocker( wfMsg( 'proxyblocker' ) );
+ $block->mReason = wfMsg( 'proxyblockreason' );
+ $block->setTarget( $ip );
+ } elseif ( $this->isAnon() && $this->isDnsBlacklisted(
$ip ) ) {
+ $block = new Block;
+ $block->setBlocker( wfMsg( 'sorbs' ) );
+ $block->mReason = wfMsg( 'sorbsreason' );
+ $block->setTarget( $ip );
}
+ }
- # DNSBL
- if ( !$this->mBlockedby && !$this->getID() ) {
- if ( $this->isDnsBlacklisted( $ip ) ) {
- $this->mBlockedby = wfMsg( 'sorbs' );
- $this->mBlockreason = wfMsg(
'sorbsreason' );
- }
- }
+ if ( $block instanceof Block ) {
+ wfDebug( __METHOD__ . ": Found block.\n" );
+ $this->mBlock = $block;
+ $this->mBlockedby = $block->getByName();
+ $this->mBlockreason = $block->mReason;
+ $this->mHideName = $block->mHideName;
+ $this->mAllowUsertalk = !$block->prevents(
'editownusertalk' );
+ } else {
+ $this->mBlockedby = '';
+ $this->mHideName = 0;
+ $this->mAllowUsertalk = false;
}
# Extensions
Modified: trunk/phase3/RELEASE-NOTES-1.19
===================================================================
--- trunk/phase3/RELEASE-NOTES-1.19 2012-03-18 22:13:55 UTC (rev 114116)
+++ trunk/phase3/RELEASE-NOTES-1.19 2012-03-18 22:19:00 UTC (rev 114117)
@@ -24,6 +24,7 @@
preloaded into edit summary on section edit
* (bug 31417) New ID mw-content-text around the actual page text, without
categories,
contentSub, ... The same div often also contains the class
mw-content-ltr/rtl.
+* (bug 35303) Proxy and DNS blacklist blocking works again
=== Configuration changes in 1.19 ===
* Removed SkinTemplateSetupPageCss hook; use BeforePageDisplay instead.
Modified: trunk/phase3/includes/User.php
===================================================================
--- trunk/phase3/includes/User.php 2012-03-18 22:13:55 UTC (rev 114116)
+++ trunk/phase3/includes/User.php 2012-03-18 22:19:00 UTC (rev 114117)
@@ -1273,10 +1273,6 @@
// overwriting mBlockedby, surely?
$this->load();
- $this->mBlockedby = 0;
- $this->mHideName = 0;
- $this->mAllowUsertalk = 0;
-
# We only need to worry about passing the IP address to the
Block generator if the
# user is not immune to autoblocks/hardblocks, and they are the
current user so we
# know which IP address they're actually coming from
@@ -1287,30 +1283,37 @@
}
# User/IP blocking
- $this->mBlock = Block::newFromTarget( $this->getName(), $ip,
!$bFromSlave );
- if ( $this->mBlock instanceof Block ) {
- wfDebug( __METHOD__ . ": Found block.\n" );
- $this->mBlockedby = $this->mBlock->getByName();
- $this->mBlockreason = $this->mBlock->mReason;
- $this->mHideName = $this->mBlock->mHideName;
- $this->mAllowUsertalk = !$this->mBlock->prevents(
'editownusertalk' );
- }
+ $block = Block::newFromTarget( $this->getName(), $ip,
!$bFromSlave );
# Proxy blocking
- if ( $ip !== null && !$this->isAllowed( 'proxyunbannable' ) &&
!in_array( $ip, $wgProxyWhitelist ) ) {
+ if ( !$block instanceof Block && $ip !== null &&
!$this->isAllowed( 'proxyunbannable' )
+ && !in_array( $ip, $wgProxyWhitelist ) )
+ {
# Local list
if ( self::isLocallyBlockedProxy( $ip ) ) {
- $this->mBlockedby = wfMsg( 'proxyblocker' );
- $this->mBlockreason = wfMsg( 'proxyblockreason'
);
+ $block = new Block;
+ $block->setBlocker( wfMsg( 'proxyblocker' ) );
+ $block->mReason = wfMsg( 'proxyblockreason' );
+ $block->setTarget( $ip );
+ } elseif ( $this->isAnon() && $this->isDnsBlacklisted(
$ip ) ) {
+ $block = new Block;
+ $block->setBlocker( wfMsg( 'sorbs' ) );
+ $block->mReason = wfMsg( 'sorbsreason' );
+ $block->setTarget( $ip );
}
+ }
- # DNSBL
- if ( !$this->mBlockedby && !$this->getID() ) {
- if ( $this->isDnsBlacklisted( $ip ) ) {
- $this->mBlockedby = wfMsg( 'sorbs' );
- $this->mBlockreason = wfMsg(
'sorbsreason' );
- }
- }
+ if ( $block instanceof Block ) {
+ wfDebug( __METHOD__ . ": Found block.\n" );
+ $this->mBlock = $block;
+ $this->mBlockedby = $block->getByName();
+ $this->mBlockreason = $block->mReason;
+ $this->mHideName = $block->mHideName;
+ $this->mAllowUsertalk = !$block->prevents(
'editownusertalk' );
+ } else {
+ $this->mBlockedby = '';
+ $this->mHideName = 0;
+ $this->mAllowUsertalk = false;
}
# Extensions
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs