Followup r70207, make path for LocalSettings.php configurable
authorChad Horohoe <demon@users.mediawiki.org>
Tue, 2 Nov 2010 17:11:35 +0000 (17:11 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Tue, 2 Nov 2010 17:11:35 +0000 (17:11 +0000)
includes/installer/CliInstaller.php
includes/installer/LocalSettingsGenerator.php
maintenance/install.php

index 0893ee1..61c9470 100644 (file)
@@ -85,9 +85,16 @@ class CliInstaller extends CoreInstaller {
                        array( $this, 'startStage' ),
                        array( $this, 'endStage' )
                );
+       }
 
+       /**
+        * Write LocalSettings.php to a given path
+        *
+        * @param $path String Full path to write LocalSettings.php to
+        */
+       public function writeConfigurationFile( $path ) {
                $ls = new LocalSettingsGenerator( $this );
-               file_put_contents( "LocalSettings.php", $ls->getText() );
+               $ls->writeFile( "$path/LocalSettings.php" );
        }
 
        public function startStage( $step ) {
index 1ddc700..08df2b7 100644 (file)
@@ -122,6 +122,15 @@ class LocalSettingsGenerator {
                return $localSettings;
        }
 
+       /**
+        * Write the generated LocalSettings to a file
+        *
+        * @param $fileName String Full path to filename to write to
+        */
+       public function writeFile( $fileName ) {
+               file_put_contents( $fileName, $ls->getText() );
+       }
+
        /**
         * @return String
         */
index a7b5179..4d3cbcc 100644 (file)
@@ -27,6 +27,7 @@ require_once( dirname( dirname( __FILE__ ) )."/maintenance/Maintenance.php" );
 class CommandLineInstaller extends Maintenance {
        public function __construct() {
                parent::__construct();
+               global $IP;
 
                $this->addArg( 'name', 'The name of the wiki', true);
 
@@ -47,18 +48,21 @@ class CommandLineInstaller extends Maintenance {
                $this->addOption( 'installdbpass', 'The pasword for the DB user to install as.', false, true );
                $this->addOption( 'dbuser', 'The user to use for normal operations (wikiuser)', false, true );
                $this->addOption( 'dbpass', 'The pasword for the DB user for normal operations', false, true );
+               $this->addOption( 'confpath', "Path to write LocalSettings.php to, default $IP", false, true );
                /* $this->addOption( 'dbschema', 'The schema for the MediaWiki DB in pg (mediawiki)', false, true ); */
                /* $this->addOption( 'dbtsearch2schema', 'The schema for the tsearch2 DB in pg (public)', false, true ); */
                /* $this->addOption( 'namespace', 'The project namespace (same as the name)', false, true ); */
        }
 
        public function execute() {
+               global $IP;
                $adminName = isset( $this->mArgs[1] ) ? $this->mArgs[1] : null;
 
                $installer =
                        new CliInstaller( $this->mArgs[0], $adminName, $this->mOptions );
 
                $installer->execute();
+               $installer->writeConfigurationFile( $this->getOption( 'confpath', $IP ) );
        }
 }