4 * Maintenance script to create an account and grant it administrator rights
7 * @subpackage Maintenance
8 * @author Rob Church <robchur@gmail.com>
11 require_once( 'commandLine.inc' );
13 if( !count( $args ) == 2 ) {
14 echo( "Please provide a username and password for the new account.\n" );
22 echo( "{$wgDBname}: Creating and promoting User:{$username}..." );
24 # Validate username and check it doesn't exist
25 $user = User
::newFromName( $username );
26 if( !is_object( $user ) ) {
27 echo( "invalid username.\n" );
29 } elseif( 0 != $user->idForName() ) {
30 echo( "account exists.\n" );
34 # Insert the account into the database
35 $user->addToDatabase();
36 $user->setPassword( $password );
40 $user->addGroup( 'sysop' );
42 # Increment site_stats.ss_users
43 $ssu = new SiteStatsUpdate( 0, 0, 0, 0, 1 );