From d8db86a4a6e52db1cc29eaf381d34ab9baa8e429 Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Tue, 11 Oct 2011 21:24:00 +0000 Subject: [PATCH] Fix cli install so that db user is created if needed. --- includes/installer/CliInstaller.php | 3 +++ includes/installer/PostgresInstaller.php | 14 ++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) 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() { -- 2.20.1