From 719483a29b98e281efe38adaf529edd2b5192de0 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Tue, 2 Nov 2010 17:11:35 +0000 Subject: [PATCH] Followup r70207, make path for LocalSettings.php configurable --- includes/installer/CliInstaller.php | 9 ++++++++- includes/installer/LocalSettingsGenerator.php | 9 +++++++++ maintenance/install.php | 4 ++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/includes/installer/CliInstaller.php b/includes/installer/CliInstaller.php index 0893ee1aa8..61c9470d65 100644 --- a/includes/installer/CliInstaller.php +++ b/includes/installer/CliInstaller.php @@ -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 ) { diff --git a/includes/installer/LocalSettingsGenerator.php b/includes/installer/LocalSettingsGenerator.php index 1ddc700f8a..08df2b75ad 100644 --- a/includes/installer/LocalSettingsGenerator.php +++ b/includes/installer/LocalSettingsGenerator.php @@ -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 */ diff --git a/maintenance/install.php b/maintenance/install.php index a7b51794fd..4d3cbcc0e7 100644 --- a/maintenance/install.php +++ b/maintenance/install.php @@ -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 ) ); } } -- 2.20.1