r94420 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94419‎ | r94420 | r94421 >
Date:17:00, 13 August 2011
Author:catrope
Status:ok
Tags:
Comment:
Revert r94351, which merged r94350 from trunk to 1.18: code was unreviewed and breaks a unit test. I'll tag r94350 for merging, it'll be merged once it's been fixed and reviewed.
Modified paths:
  • /branches/REL1_18/phase3/includes/Block.php (modified) (history)

Diff [purge]

Index: branches/REL1_18/phase3/includes/Block.php
@@ -1057,19 +1057,6 @@
10581058 return array( null, null );
10591059 }
10601060
1061 - if ( IP::isValid( $target ) ) {
1062 - # We can still create a User if it's an IP address, but we need to turn
1063 - # off validation checking (which would exclude IP addresses)
1064 - return array(
1065 - User::newFromName( IP::sanitizeIP( $target ), false ),
1066 - Block::TYPE_IP
1067 - );
1068 -
1069 - } elseif ( IP::isValidBlock( $target ) ) {
1070 - # Can't create a User from an IP range
1071 - return array( IP::sanitizeRange( $target ), Block::TYPE_RANGE );
1072 - }
1073 -
10741061 # Consider the possibility that this is not a username at all
10751062 # but actually an old subpage (bug #29797)
10761063 if( strpos( $target, '/' ) !== false ){
@@ -1085,6 +1072,18 @@
10861073 # since hash characters are not valid in usernames or titles generally.
10871074 return array( $userObj, Block::TYPE_USER );
10881075
 1076+ } elseif ( IP::isValid( $target ) ) {
 1077+ # We can still create a User if it's an IP address, but we need to turn
 1078+ # off validation checking (which would exclude IP addresses)
 1079+ return array(
 1080+ User::newFromName( IP::sanitizeIP( $target ), false ),
 1081+ Block::TYPE_IP
 1082+ );
 1083+
 1084+ } elseif ( IP::isValidBlock( $target ) ) {
 1085+ # Can't create a User from an IP range
 1086+ return array( IP::sanitizeRange( $target ), Block::TYPE_RANGE );
 1087+
10891088 } elseif ( preg_match( '/^#\d+$/', $target ) ) {
10901089 # Autoblock reference in the form "#12345"
10911090 return array( substr( $target, 1 ), Block::TYPE_AUTO );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r94350Fix r91886 thanks to johnduhart: check if it is an IP *before* stripping subp...robin14:32, 12 August 2011
r94351merge r94350robin14:33, 12 August 2011

Status & tagging log