From 99b0296945aab9731d44fe84c0c295a10f831ad4 Mon Sep 17 00:00:00 2001 From: addshore Date: Tue, 4 Jul 2017 19:22:23 +0100 Subject: [PATCH] Don't ask for password for env-checks in install.php Bug: T169669 Change-Id: I00dbaca0e4532ecc499317ec8f1cb7f9eb872db3 --- maintenance/install.php | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/maintenance/install.php b/maintenance/install.php index 3e632f0661..81b6d9c8be 100644 --- a/maintenance/install.php +++ b/maintenance/install.php @@ -95,7 +95,30 @@ class CommandLineInstaller extends Maintenance { $siteName = $this->getArg( 0, 'MediaWiki' ); // Will not be set if used with --env-checks $adminName = $this->getArg( 1 ); + $envChecksOnly = $this->hasOption( 'env-checks' ); + $this->setDbPassOption(); + if ( !$envChecksOnly ) { + $this->setPassOption(); + } + + $installer = InstallerOverrides::getCliInstaller( $siteName, $adminName, $this->mOptions ); + + $status = $installer->doEnvironmentChecks(); + if ( $status->isGood() ) { + $installer->showMessage( 'config-env-good' ); + } else { + $installer->showStatusMessage( $status ); + + return; + } + if ( !$envChecksOnly ) { + $installer->execute(); + $installer->writeConfigurationFile( $this->getOption( 'confpath', $IP ) ); + } + } + + private function setDbPassOption() { $dbpassfile = $this->getOption( 'dbpassfile' ); if ( $dbpassfile !== null ) { if ( $this->getOption( 'dbpass' ) !== null ) { @@ -110,7 +133,9 @@ class CommandLineInstaller extends Maintenance { } $this->mOptions['dbpass'] = trim( $dbpass, "\r\n" ); } + } + private function setPassOption() { $passfile = $this->getOption( 'passfile' ); if ( $passfile !== null ) { if ( $this->getOption( 'pass' ) !== null ) { @@ -127,21 +152,6 @@ class CommandLineInstaller extends Maintenance { } elseif ( $this->getOption( 'pass' ) === null ) { $this->error( 'You need to provide the option "pass" or "passfile"', true ); } - - $installer = InstallerOverrides::getCliInstaller( $siteName, $adminName, $this->mOptions ); - - $status = $installer->doEnvironmentChecks(); - if ( $status->isGood() ) { - $installer->showMessage( 'config-env-good' ); - } else { - $installer->showStatusMessage( $status ); - - return; - } - if ( !$this->hasOption( 'env-checks' ) ) { - $installer->execute(); - $installer->writeConfigurationFile( $this->getOption( 'confpath', $IP ) ); - } } function validateParamsAndArgs() { -- 2.20.1