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" );
21 echo( wfWikiID() . ": Creating and promoting User:{$username}..." );
23 # Validate username and check it doesn't exist
24 $user = User
::newFromName( $username );
25 if( !is_object( $user ) ) {
26 echo( "invalid username.\n" );
28 } elseif( 0 != $user->idForName() ) {
29 echo( "account exists.\n" );
33 # Insert the account into the database
34 $user->addToDatabase();
35 $user->setPassword( $password );
39 $user->addGroup( 'sysop' );
41 # Increment site_stats.ss_users
42 $ssu = new SiteStatsUpdate( 0, 0, 0, 0, 1 );