X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Finstall.php;h=cac3009a8f49faf37f997f4e25e9424b6af394b1;hb=252fa957ad2442d25ce2d5b7f06ecfd71da2c1f9;hp=3e632f066106f3bfc9e8787d6463deed7b5cdde9;hpb=3eebaaffcf25c3779725309570de924ad5bea766;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/install.php b/maintenance/install.php index 3e632f0661..cac3009a8f 100644 --- a/maintenance/install.php +++ b/maintenance/install.php @@ -90,12 +90,42 @@ class CommandLineInstaller extends Maintenance { $this->addOption( 'env-checks', "Run environment checks only, don't change anything" ); } + public function getDbType() { + if ( $this->hasOption( 'env-checks' ) ) { + return Maintenance::DB_NONE; + } + return parent::getDbType(); + } + function execute() { global $IP; $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 +140,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 +159,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() {