r76811 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76810‎ | r76811 | r76812 >
Date:18:13, 16 November 2010
Author:maxsem
Status:ok
Tags:
Comment:
Added --env-checks parameter to install.php that checks for prerequisites instead of installing
Modified paths:
  • /trunk/phase3/includes/installer/CliInstaller.php (modified) (history)
  • /trunk/phase3/maintenance/install.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/CliInstaller.php
@@ -120,7 +120,11 @@
121121 }
122122
123123 public function showMessage( $msg /*, ... */ ) {
124 - echo html_entity_decode( strip_tags( $msg ), ENT_QUOTES );
 124+ $params = func_get_args();
 125+ array_shift( $params );
 126+ $text = wfMsgExt( $msg, array( 'parseinline' ), $params );
 127+ $text = preg_replace( '/<a href="(.*?)".*?>(.*?)<\/a>/', '$2 &lt;$1&gt;', $text );
 128+ echo html_entity_decode( strip_tags( $text ), ENT_QUOTES ) . "\n";
125129 flush();
126130 }
127131
Index: trunk/phase3/maintenance/install.php
@@ -52,18 +52,31 @@
5353 /* $this->addOption( 'dbschema', 'The schema for the MediaWiki DB in pg (mediawiki)', false, true ); */
5454 /* $this->addOption( 'dbtsearch2schema', 'The schema for the tsearch2 DB in pg (public)', false, true ); */
5555 /* $this->addOption( 'namespace', 'The project namespace (same as the name)', false, true ); */
 56+ $this->addOption( 'env-checks', "Run environment checks only, don't change anything" );
5657 }
5758
5859 public function execute() {
59 - global $IP;
 60+ global $IP, $wgTitle;
 61+ $siteName = isset( $this->mArgs[0] ) ? $this->mArgs[0] : "Don't care"; // Will not be set if used with --env-checks
6062 $adminName = isset( $this->mArgs[1] ) ? $this->mArgs[1] : null;
 63+ $wgTitle = Title::newFromText( 'Installer script' );
6164
6265 $installer =
63 - new CliInstaller( $this->mArgs[0], $adminName, $this->mOptions );
 66+ new CliInstaller( $siteName, $adminName, $this->mOptions );
6467
65 - $installer->execute();
66 - $installer->writeConfigurationFile( $this->getOption( 'confpath', $IP ) );
 68+ if ( $this->hasOption( 'env-checks' ) ) {
 69+ $installer->doEnvironmentChecks();
 70+ } else {
 71+ $installer->execute();
 72+ $installer->writeConfigurationFile( $this->getOption( 'confpath', $IP ) );
 73+ }
6774 }
 75+
 76+ protected function validateParamsAndArgs() {
 77+ if ( !$this->hasOption( 'env-checks' ) ) {
 78+ parent::validateParamsAndArgs();
 79+ }
 80+ }
6881 }
6982
7083 $maintClass = "CommandLineInstaller";

Status & tagging log