4 * Maintenance script to create an account and grant it administrator rights
6 * @addtogroup Maintenance
7 * @author Rob Church <robchur@gmail.com>
10 require_once( 'commandLine.inc' );
12 if( !count( $args ) == 2 ) {
13 echo( "Please provide a username and password for the new account.\n" );
20 echo( wfWikiID() . ": Creating and promoting User:{$username}..." );
22 # Validate username and check it doesn't exist
23 $user = User
::newFromName( $username );
24 if( !is_object( $user ) ) {
25 echo( "invalid username.\n" );
27 } elseif( 0 != $user->idForName() ) {
28 echo( "account exists.\n" );
32 # Insert the account into the database
33 $user->addToDatabase();
34 $user->setPassword( $password );
38 $user->addGroup( 'sysop' );
40 # Increment site_stats.ss_users
41 $ssu = new SiteStatsUpdate( 0, 0, 0, 0, 1 );