From 919c1af52c457b3473047448edc0ccc67f398dc3 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Fri, 19 May 2006 17:50:08 +0000 Subject: [PATCH] * (bug 5187) Allow programmatically bypassing username validation, for scripts --- RELEASE-NOTES | 2 ++ includes/User.php | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 6085c5b499..8eb5b0a4e1 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -299,6 +299,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 6009) Use {{ns:project}} in messages where appropriate * (bug 6012) Update to Indonesian localisation (id) * (bug 6017) Update list of bookstores in German localisation files +* (bug 5187) Allow programmatically bypassing username validation, for scripts + == Compatibility == diff --git a/includes/User.php b/includes/User.php index 60a1bbed34..2a3a8cf19a 100644 --- a/includes/User.php +++ b/includes/User.php @@ -58,10 +58,11 @@ class User { /** * Static factory method * @param string $name Username, validated by Title:newFromText() + * @param bool $validate Validate username * @return User * @static */ - function newFromName( $name ) { + function newFromName( $name, $validate = true ) { # Force usernames to capital global $wgContLang; $name = $wgContLang->ucfirst( $name ); @@ -77,7 +78,7 @@ class User { global $wgAuth; $canonicalName = $wgAuth->getCanonicalName( $t->getText() ); - if( !User::isValidUserName( $canonicalName ) ) { + if( $validate && !User::isValidUserName( $canonicalName ) ) { return null; } -- 2.20.1