Fix cli install so that db user is created if needed.
authorMark A. Hershberger <mah@users.mediawiki.org>
Tue, 11 Oct 2011 21:24:00 +0000 (21:24 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Tue, 11 Oct 2011 21:24:00 +0000 (21:24 +0000)
includes/installer/CliInstaller.php
includes/installer/PostgresInstaller.php

index e0c2cfb..ec6603f 100644 (file)
@@ -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'] ) ) {
index 7c4a6a8..74688e1 100644 (file)
@@ -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() {