MediaWiki  REL1_24
UserWrapper.php
Go to the documentation of this file.
00001 <?php
00002 
00003 class UserWrapper {
00004     public $userName;
00005     public $password;
00006     public $user;
00007 
00008     public function __construct( $userName, $password, $group = '' ) {
00009         $this->userName = $userName;
00010         $this->password = $password;
00011 
00012         $this->user = User::newFromName( $this->userName );
00013         if ( !$this->user->getID() ) {
00014             $this->user = User::createNew( $this->userName, array(
00015                 "email" => "[email protected]",
00016                 "real_name" => "Test User" ) );
00017         }
00018         $this->user->setPassword( $this->password );
00019 
00020         if ( $group !== '' ) {
00021             $this->user->addGroup( $group );
00022         }
00023         $this->user->saveSettings();
00024     }
00025 }