From 233a850a0822aae18e431bd5c894bb21f4497627 Mon Sep 17 00:00:00 2001 From: Marius Hoch Date: Mon, 25 Mar 2013 01:02:40 +0100 Subject: [PATCH] Make AbuseLog searchable by IPv6 IPs Bug: 39449 Change-Id: Ie331ec7ef3b461ae10f0e28fe50cb86684c6d3a0 --- special/SpecialAbuseLog.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/special/SpecialAbuseLog.php b/special/SpecialAbuseLog.php index 1de72549f..38a0f150f 100644 --- a/special/SpecialAbuseLog.php +++ b/special/SpecialAbuseLog.php @@ -70,14 +70,17 @@ class SpecialAbuseLog extends SpecialPage { $request = $this->getRequest(); - $this->mSearchUser = $request->getText( 'wpSearchUser' ); + $this->mSearchUser = trim( $request->getText( 'wpSearchUser' ) ); if ( $wgAbuseFilterIsCentral ) { $this->mSearchWiki = $request->getText( 'wpSearchWiki' ); } - $t = Title::newFromText( trim( $this->mSearchUser ) ); - if ( $t ) { - $this->mSearchUser = $t->getText(); // Username normalisation + $u = User::newFromName( $this->mSearchUser ); + if ( $u ) { + $this->mSearchUser = $u->getName(); // Username normalisation + } elseif( IP::isIPAddress( $this->mSearchUser ) ) { + // It's an IP + $this->mSearchUser = IP::sanitizeIP( $this->mSearchUser ); } else { $this->mSearchUser = null; } @@ -207,7 +210,6 @@ class SpecialAbuseLog extends SpecialPage { $user = User::newFromName( $this->mSearchUser ); if ( !$user ) { - $conds[] = 'afl_ip=afl_user_text'; $conds['afl_user'] = 0; $conds['afl_user_text'] = $this->mSearchUser; } else {