Merge "Remove no-op parameter from UIDGeneratorTest"
[lhc/web/wiklou.git] / includes / installer / CliInstaller.php
index c6939a8..7ecb71c 100644 (file)
@@ -30,7 +30,7 @@
 class CliInstaller extends Installer {
        private $specifiedScriptPath = false;
 
-       private $optionMap = array(
+       private $optionMap = [
                'dbtype' => 'wgDBtype',
                'dbserver' => 'wgDBserver',
                'dbname' => 'wgDBname',
@@ -44,7 +44,7 @@ class CliInstaller extends Installer {
                'dbpath' => 'wgSQLiteDataDir',
                'server' => 'wgServer',
                'scriptpath' => 'wgScriptPath',
-       );
+       ];
 
        /**
         * Constructor.
@@ -53,7 +53,7 @@ class CliInstaller extends Installer {
         * @param string $admin
         * @param array $option
         */
-       function __construct( $siteName, $admin = null, array $option = array() ) {
+       function __construct( $siteName, $admin = null, array $option = [] ) {
                global $wgContLang;
 
                parent::__construct();
@@ -75,6 +75,7 @@ class CliInstaller extends Installer {
                        $wgContLang = Language::factory( $option['lang'] );
                        $wgLang = Language::factory( $option['lang'] );
                        $wgLanguageCode = $option['lang'];
+                       RequestContext::getMain()->setLanguage( $wgLang );
                }
 
                $this->setVar( 'wgSitename', $siteName );
@@ -107,6 +108,15 @@ class CliInstaller extends Installer {
                if ( isset( $option['pass'] ) ) {
                        $this->setVar( '_AdminPassword', $option['pass'] );
                }
+
+               // Set up the default skins
+               $skins = $this->findExtensions( 'skins' );
+               $this->setVar( '_Skins', $skins );
+
+               if ( $skins ) {
+                       $skinNames = array_map( 'strtolower', $skins );
+                       $this->setVar( 'wgDefaultSkin', $this->getDefaultSkin( $skinNames ) );
+               }
        }
 
        /**
@@ -121,8 +131,8 @@ class CliInstaller extends Installer {
                }
 
                $this->performInstallation(
-                       array( $this, 'startStage' ),
-                       array( $this, 'endStage' )
+                       [ $this, 'startStage' ],
+                       [ $this, 'endStage' ]
                );
        }
 
@@ -179,11 +189,16 @@ class CliInstaller extends Installer {
        public function showHelpBox( $msg /*, ... */ ) {
        }
 
-       /**
-        * @param Status $status
-        */
        public function showStatusMessage( Status $status ) {
-               parent::showStatusMessage( $status );
+               $warnings = array_merge( $status->getWarningsArray(),
+                       $status->getErrorsArray() );
+
+               if ( count( $warnings ) !== 0 ) {
+                       foreach ( $warnings as $w ) {
+                               call_user_func_array( [ $this, 'showMessage' ], $w );
+                       }
+               }
+
                if ( !$status->isOk() ) {
                        echo "\n";
                        exit( 1 );