Index: branches/new-installer/phase3/includes/installer/WebInstaller.php |
— | — | @@ -1562,7 +1562,8 @@ |
1563 | 1563 | } |
1564 | 1564 | $this->setVar( 'wgSecretKey', $secretKey ); |
1565 | 1565 | |
1566 | | - // @TODO create admin account |
| 1566 | + // @TODO initialize DB first |
| 1567 | + //$this->createWikiSysop(); |
1567 | 1568 | |
1568 | 1569 | $this->startStage( 'config-install-localsettings' ); |
1569 | 1570 | $localSettings = new LocalSettings( $this->parent ); |
— | — | @@ -1572,6 +1573,20 @@ |
1573 | 1574 | $this->endForm(); |
1574 | 1575 | } |
1575 | 1576 | |
| 1577 | + private function createWikiSysop() { |
| 1578 | + $user = User::newFromName( $this->getVar( '_AdminName' ) ); |
| 1579 | + if ( !$user ) { |
| 1580 | + //@todo |
| 1581 | + } |
| 1582 | + if ( $user->idForName() == 0 ) { |
| 1583 | + $user->addToDatabase(); |
| 1584 | + $user->setPassword( $this->getVar( '_AdminPassword' ) ); |
| 1585 | + $user->saveSettings(); |
| 1586 | + $user->addGroup( 'sysop' ); |
| 1587 | + $user->addGroup( 'bureaucrat' ); |
| 1588 | + } |
| 1589 | + } |
| 1590 | + |
1576 | 1591 | private function startStage( $msg ) { |
1577 | 1592 | $this->parent->output->addHTML( "<li>" . wfMsgHtml( $msg ) . wfMsg( 'ellipsis') ); |
1578 | 1593 | } |