* (bug 5187) Allow programmatically bypassing username validation, for scripts
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 19 May 2006 17:50:08 +0000 (17:50 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 19 May 2006 17:50:08 +0000 (17:50 +0000)
RELEASE-NOTES
includes/User.php

index 6085c5b..8eb5b0a 100644 (file)
@@ -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 ==
 
index 60a1bbe..2a3a8cf 100644 (file)
@@ -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;
                }