r75858 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75857‎ | r75858 | r75859 >
Date:17:11, 2 November 2010
Author:demon
Status:resolved (Comments)
Tags:
Comment:
Followup r70207, make path for LocalSettings.php configurable
Modified paths:
  • /trunk/phase3/includes/installer/CliInstaller.php (modified) (history)
  • /trunk/phase3/includes/installer/LocalSettingsGenerator.php (modified) (history)
  • /trunk/phase3/maintenance/install.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/install.php
@@ -27,6 +27,7 @@
2828 class CommandLineInstaller extends Maintenance {
2929 public function __construct() {
3030 parent::__construct();
 31+ global $IP;
3132
3233 $this->addArg( 'name', 'The name of the wiki', true);
3334
@@ -47,18 +48,21 @@
4849 $this->addOption( 'installdbpass', 'The pasword for the DB user to install as.', false, true );
4950 $this->addOption( 'dbuser', 'The user to use for normal operations (wikiuser)', false, true );
5051 $this->addOption( 'dbpass', 'The pasword for the DB user for normal operations', false, true );
 52+ $this->addOption( 'confpath', "Path to write LocalSettings.php to, default $IP", false, true );
5153 /* $this->addOption( 'dbschema', 'The schema for the MediaWiki DB in pg (mediawiki)', false, true ); */
5254 /* $this->addOption( 'dbtsearch2schema', 'The schema for the tsearch2 DB in pg (public)', false, true ); */
5355 /* $this->addOption( 'namespace', 'The project namespace (same as the name)', false, true ); */
5456 }
5557
5658 public function execute() {
 59+ global $IP;
5760 $adminName = isset( $this->mArgs[1] ) ? $this->mArgs[1] : null;
5861
5962 $installer =
6063 new CliInstaller( $this->mArgs[0], $adminName, $this->mOptions );
6164
6265 $installer->execute();
 66+ $installer->writeConfigurationFile( $this->getOption( 'confpath', $IP ) );
6367 }
6468 }
6569
Index: trunk/phase3/includes/installer/LocalSettingsGenerator.php
@@ -123,6 +123,15 @@
124124 }
125125
126126 /**
 127+ * Write the generated LocalSettings to a file
 128+ *
 129+ * @param $fileName String Full path to filename to write to
 130+ */
 131+ public function writeFile( $fileName ) {
 132+ file_put_contents( $fileName, $ls->getText() );
 133+ }
 134+
 135+ /**
127136 * @return String
128137 */
129138 private function buildMemcachedServerList() {
Index: trunk/phase3/includes/installer/CliInstaller.php
@@ -85,9 +85,16 @@
8686 array( $this, 'startStage' ),
8787 array( $this, 'endStage' )
8888 );
 89+ }
8990
 91+ /**
 92+ * Write LocalSettings.php to a given path
 93+ *
 94+ * @param $path String Full path to write LocalSettings.php to
 95+ */
 96+ public function writeConfigurationFile( $path ) {
9097 $ls = new LocalSettingsGenerator( $this );
91 - file_put_contents( "LocalSettings.php", $ls->getText() );
 98+ $ls->writeFile( "$path/LocalSettings.php" );
9299 }
93100
94101 public function startStage( $step ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r75874Fixup r75858, copy+paste errordemon20:26, 2 November 2010
r78308Fix for r75858: Move $IP detection further up so it can be used in child cons...demon15:30, 13 December 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r70207* Make parsertests work with interwiki table on sqlite...mah20:17, 30 July 2010

Comments

#Comment by Platonides (talk | contribs)   23:31, 7 December 2010

$IP is not set until Maintenance::setup(), which is called after object construction. $IP won't be set when adding confpath option.

#Comment by 😂 (talk | contribs)   15:31, 13 December 2010

Moved $IP to Maintenance's constructor. Should work fine now.

Status & tagging log