r94351 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94350‎ | r94351 | r94352 >
Date:14:33, 12 August 2011
Author:robin
Status:reverted (Comments)
Tags:
Comment:
merge r94350
Modified paths:
  • /branches/REL1_18/phase3/includes/Block.php (modified) (history)

Diff [purge]

Index: branches/REL1_18/phase3/includes/Block.php
@@ -1057,6 +1057,19 @@
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+
10611074 # Consider the possibility that this is not a username at all
10621075 # but actually an old subpage (bug #29797)
10631076 if( strpos( $target, '/' ) !== false ){
@@ -1072,18 +1085,6 @@
10731086 # since hash characters are not valid in usernames or titles generally.
10741087 return array( $userObj, Block::TYPE_USER );
10751088
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 -
10881089 } elseif ( preg_match( '/^#\d+$/', $target ) ) {
10891090 # Autoblock reference in the form "#12345"
10901091 return array( substr( $target, 1 ), Block::TYPE_AUTO );

Follow-up revisions

RevisionCommit summaryAuthorDate
r94420Revert r94351, which merged r94350 from trunk to 1.18: code was unreviewed an...catrope17:00, 13 August 2011

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

Comments

#Comment by Krinkle (talk | contribs)   14:44, 12 August 2011

Please don't backport before code review.

#Comment by SPQRobin (talk | contribs)   14:52, 12 August 2011

But I was thinking it would be better to backport now so we don't forget it later on.

Or should I instead add a tag to the revision that needs backporting after review?

#Comment by Catrope (talk | contribs)   16:18, 12 August 2011

Yes, tag it with '1.18' and someone will merge it after it's been reviewed.

Status & tagging log