Display error if Installer->execute() doesn't return a good status object
[lhc/web/wiklou.git] / maintenance / install.php
index 3395458..16b8ccf 100644 (file)
@@ -115,7 +115,12 @@ class CommandLineInstaller extends Maintenance {
                        $this->setPassOption();
                }
 
-               $installer = InstallerOverrides::getCliInstaller( $siteName, $adminName, $this->mOptions );
+               try {
+                       $installer = InstallerOverrides::getCliInstaller( $siteName, $adminName, $this->mOptions );
+               } catch ( \MediaWiki\Installer\InstallException $e ) {
+                       $this->output( $e->getStatus()->getMessage()->text() . "\n" );
+                       return false;
+               }
 
                $status = $installer->doEnvironmentChecks();
                if ( $status->isGood() ) {
@@ -123,12 +128,23 @@ class CommandLineInstaller extends Maintenance {
                } else {
                        $installer->showStatusMessage( $status );
 
-                       return;
+                       return false;
                }
                if ( !$envChecksOnly ) {
-                       $installer->execute();
+                       $status = $installer->execute();
+                       if ( !$status->isGood() ) {
+                               $installer->showStatusMessage( $status );
+
+                               return false;
+                       }
                        $installer->writeConfigurationFile( $this->getOption( 'confpath', $IP ) );
+                       $installer->showMessage(
+                               'config-install-success',
+                               $installer->getVar( 'wgServer' ),
+                               $installer->getVar( 'wgScriptPath' )
+                       );
                }
+               return true;
        }
 
        private function setDbPassOption() {