X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Finstaller%2FCliInstaller.php;h=99d594df972fc3e0d913aa23023c7260ac26bfe3;hb=b873e9294b87ee256df581e2cc9e83ef814871c0;hp=567fb10a6913e518f61a349b01d997752f9a6f1c;hpb=204d0df4d2bb8139109253f3da1df42cd455850c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/installer/CliInstaller.php b/includes/installer/CliInstaller.php index 567fb10a69..99d594df97 100644 --- a/includes/installer/CliInstaller.php +++ b/includes/installer/CliInstaller.php @@ -21,6 +21,7 @@ * @ingroup Deployment */ +use MediaWiki\Installer\InstallException; use MediaWiki\MediaWikiServices; /** @@ -51,6 +52,7 @@ class CliInstaller extends Installer { * @param string $siteName * @param string|null $admin * @param array $options + * @throws InstallException */ function __construct( $siteName, $admin = null, array $options = [] ) { global $wgContLang; @@ -114,7 +116,7 @@ class CliInstaller extends Installer { $status = $this->validateExtensions( 'extension', 'extensions', $options['extensions'] ); if ( !$status->isOK() ) { - $this->showStatusMessage( $status ); + throw new InstallException( $status ); } $this->setVar( '_Extensions', $status->value ); } elseif ( isset( $options['with-extensions'] ) ) { @@ -125,7 +127,7 @@ class CliInstaller extends Installer { if ( isset( $options['skins'] ) ) { $status = $this->validateExtensions( 'skin', 'skins', $options['skins'] ); if ( !$status->isOK() ) { - $this->showStatusMessage( $status ); + throw new InstallException( $status ); } $skins = $status->value; } else { @@ -176,15 +178,23 @@ class CliInstaller extends Installer { $vars = Installer::getExistingLocalSettings(); if ( $vars ) { - $this->showStatusMessage( - Status::newFatal( "config-localsettings-cli-upgrade" ) - ); + $status = Status::newFatal( "config-localsettings-cli-upgrade" ); + $this->showStatusMessage( $status ); + return $status; } - $this->performInstallation( + $result = $this->performInstallation( [ $this, 'startStage' ], [ $this, 'endStage' ] ); + // PerformInstallation bails on a fatal, so make sure the last item + // completed before giving 'next.' Likewise, only provide back on failure + $lastStepStatus = end( $result ); + if ( $lastStepStatus->isOk() ) { + return Status::newGood(); + } else { + return $lastStepStatus; + } } /** @@ -248,11 +258,6 @@ class CliInstaller extends Installer { $this->showMessage( ...$w ); } } - - if ( !$status->isOK() ) { - echo "\n"; - exit( 1 ); - } } public function envCheckPath() {