Localisation updates for core messages from translatewiki.net (2009-07-22 23:12 UTC)
[lhc/web/wiklou.git] / maintenance / createAndPromote.php
index 0d30fe7..b55d920 100644 (file)
@@ -3,7 +3,8 @@
 /**
  * Maintenance script to create an account and grant it administrator rights
  *
- * @addtogroup Maintenance
+ * @file
+ * @ingroup Maintenance
  * @author Rob Church <robchur@gmail.com>
  */
 
@@ -35,9 +36,14 @@ if( !is_object( $user ) ) {
        die( 1 );
 }
 
+try {
+       $user->setPassword( $password );
+} catch( PasswordError $pwe ) {
+       $this->error( $pwe->getText(), true );
+}
+
 # Insert the account into the database
 $user->addToDatabase();
-$user->setPassword( $password );
 $user->saveSettings();
 
 # Promote user