From: Mark A. Hershberger Date: Tue, 11 Oct 2011 21:24:00 +0000 (+0000) Subject: Fix cli install so that db user is created if needed. X-Git-Tag: 1.31.0-rc.0~27137 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=d8db86a4a6e52db1cc29eaf381d34ab9baa8e429;p=lhc%2Fweb%2Fwiklou.git Fix cli install so that db user is created if needed. --- diff --git a/includes/installer/CliInstaller.php b/includes/installer/CliInstaller.php index e0c2cfb447..ec6603f98c 100644 --- a/includes/installer/CliInstaller.php +++ b/includes/installer/CliInstaller.php @@ -83,6 +83,9 @@ class CliInstaller extends Installer { $option['installdbuser'] ); $this->setVar( '_InstallPassword', $option['installdbpass'] ); + + // Assume that if we're given the installer user, we'll create the account. + $this->setVar( '_CreateDBAccount', true ); } if ( isset( $option['pass'] ) ) { diff --git a/includes/installer/PostgresInstaller.php b/includes/installer/PostgresInstaller.php index 7c4a6a802e..74688e1f3e 100644 --- a/includes/installer/PostgresInstaller.php +++ b/includes/installer/PostgresInstaller.php @@ -383,6 +383,10 @@ class PostgresInstaller extends DatabaseInstaller { } public function preInstall() { + $createDbAccount = array( + 'name' => 'user', + 'callback' => array( $this, 'setupUser' ), + ); $commitCB = array( 'name' => 'pg-commit', 'callback' => array( $this, 'commitChanges' ), @@ -395,15 +399,13 @@ class PostgresInstaller extends DatabaseInstaller { 'name' => 'schema', 'callback' => array( $this, 'setupSchema' ) ); + + if( $this->getVar( '_CreateDBAccount' ) ) { + $this->parent->addInstallStep( $createDbAccount, 'database' ); + } $this->parent->addInstallStep( $commitCB, 'interwiki' ); $this->parent->addInstallStep( $plpgCB, 'database' ); $this->parent->addInstallStep( $schemaCB, 'database' ); - if( $this->getVar( '_CreateDBAccount' ) ) { - $this->parent->addInstallStep( array( - 'name' => 'user', - 'callback' => array( $this, 'setupUser' ), - ) ); - } } function setupDatabase() {