r64225 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64224‎ | r64225 | r64226 >
Date:21:30, 26 March 2010
Author:maxsem
Status:resolved (Comments)
Tags:
Comment:
new-installer: stub for user creation, doesn't work yet
Modified paths:
  • /branches/new-installer/phase3/includes/installer/WebInstaller.php (modified) (history)

Diff [purge]

Index: branches/new-installer/phase3/includes/installer/WebInstaller.php
@@ -1562,7 +1562,8 @@
15631563 }
15641564 $this->setVar( 'wgSecretKey', $secretKey );
15651565
1566 - // @TODO create admin account
 1566+ // @TODO initialize DB first
 1567+ //$this->createWikiSysop();
15671568
15681569 $this->startStage( 'config-install-localsettings' );
15691570 $localSettings = new LocalSettings( $this->parent );
@@ -1572,6 +1573,20 @@
15731574 $this->endForm();
15741575 }
15751576
 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+
15761591 private function startStage( $msg ) {
15771592 $this->parent->output->addHTML( "<li>" . wfMsgHtml( $msg ) . wfMsg( 'ellipsis') );
15781593 }

Comments

#Comment by 😂 (talk | contribs)   21:49, 29 March 2010

Added try/catch in r64251, post-install database operations possible as of r64264.

Status & tagging log