http://www.mediawiki.org/wiki/Special:Code/MediaWiki/65698

Revision: 65698
Author:   avar
Date:     2010-04-30 16:12:24 +0000 (Fri, 30 Apr 2010)

Log Message:
-----------
Bark with something more than "Failed" if !$user or if we get a PasswordError

The root cause of this issue is failed validation earlier in the
installer. It's still a good idea to bark with specific internal
errors at this point, in case something bad happens that we hadn't
thought to check for.

In my case I got "Failed" because $user === $password. I couldn't
produce a failure in User::newFromName() but sanity checks are good.

Modified Paths:
--------------
    branches/new-installer/phase3/includes/installer/Installer.i18n.php
    branches/new-installer/phase3/includes/installer/Installer.php

Modified: branches/new-installer/phase3/includes/installer/Installer.i18n.php
===================================================================
--- branches/new-installer/phase3/includes/installer/Installer.i18n.php 
2010-04-30 16:12:22 UTC (rev 65697)
+++ branches/new-installer/phase3/includes/installer/Installer.i18n.php 
2010-04-30 16:12:24 UTC (rev 65698)
@@ -280,6 +280,8 @@
        'config-admin-password-mismatch'  => 'The two passwords you entered do 
not match.',
        'config-admin-email'              => 'E-mail address:',
        'config-admin-email-help'         => 'Enter an e-mail address here to 
allow you to receive e-mail from other users on the wiki, reset your password, 
and be notified of changes to pages on your watchlist.',
+       'config-admin-error-user'         => 'Internal error when creating an 
admin with the name "<nowiki>$1</nowiki>".',
+       'config-admin-error-password'     => 'Internal error when setting a 
password for the admin "<nowiki>$1</nowiki>": <pre>$2</pre>',
        'config-subscribe'                => 'Subscribe to the 
[https://lists.wikimedia.org/mailman/listinfo/mediawiki-announce release 
announcements mailing list].',
        'config-subscribe-help'           => 'This is a low-volume mailing list 
used for release announcements, including important security announcements.
 You should subscribe to it and update your MediaWiki installation when new 
versions come out.',

Modified: branches/new-installer/phase3/includes/installer/Installer.php
===================================================================
--- branches/new-installer/phase3/includes/installer/Installer.php      
2010-04-30 16:12:22 UTC (rev 65697)
+++ branches/new-installer/phase3/includes/installer/Installer.php      
2010-04-30 16:12:24 UTC (rev 65698)
@@ -863,15 +863,19 @@
        }
 
        public function installSysop() {
-               $user = User::newFromName( $this->getVar( '_AdminName' ) );
+               $name = $this->getVar( '_AdminName' );
+               $user = User::newFromName( $name );
                if ( !$user ) {
-                       return false; // we should've validated this earlier 
anyway!
+                       // we should've validated this earlier anyway!
+                       $this->output->addWarningMsg( 
'config-admin-error-user', $name );
+                       return false;
                }
                if ( $user->idForName() == 0 ) {
                        $user->addToDatabase();
                        try {
                                $user->setPassword( $this->getVar( 
'_AdminPassword' ) );
                        } catch( PasswordError $pwe ) {
+                               $this->output->addWarningMsg( 
'config-admin-error-password', $name, $pwe->getMessage() );
                                return false;
                        }
                        $user->saveSettings();



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to