WebInstallerOutput: Apply wfBCP47() to lang attribute
[lhc/web/wiklou.git] / includes / installer / WebInstallerOutput.php
index f797ef9..22fb1df 100644 (file)
@@ -124,53 +124,55 @@ class WebInstallerOutput {
         * @return string
         */
        public function getCSS() {
-               // Horrible, horrible hack: the installer is currently hardcoded to use the Vector skin, so load
-               // it here. Include instead of require, as this will work without it, it will just look bad.
-               // We need the 'global' statement for $wgResourceModules because the Vector skin adds the
-               // definitions for its RL modules there that we use implicitly below.
-               // @codingStandardsIgnoreStart
-               global $wgResourceModules; // This is NOT UNUSED!
-               // @codingStandardsIgnoreEnd
                global $wgStyleDirectory;
-               include_once "$wgStyleDirectory/Vector/Vector.php";
 
                $moduleNames = array(
                        // See SkinTemplate::setupSkinUserCss
                        'mediawiki.legacy.shared',
                        // See Vector::setupSkinUserCss
                        'mediawiki.skinning.interface',
-                       'skins.vector.styles',
-
-                       'mediawiki.legacy.config',
                );
 
-               $css = '';
+               if ( file_exists( "$wgStyleDirectory/Vector/Vector.php" ) ) {
+                       // Force loading Vector skin if available as a fallback skin
+                       // for whatever ResourceLoader wants to have as the default.
+
+                       // Include instead of require, as this will work without it, it will just look bad.
+                       // We need the 'global' statement for $wgResourceModules because the Vector skin adds the
+                       // definitions for its RL modules there that we use implicitly below.
+
+                       // @codingStandardsIgnoreStart
+                       global $wgResourceModules; // This is NOT UNUSED!
+                       // @codingStandardsIgnoreEnd
+
+                       include_once "$wgStyleDirectory/Vector/Vector.php";
+
+                       $moduleNames[] = 'skins.vector.styles';
+               }
+
+               $moduleNames[] = 'mediawiki.legacy.config';
 
                $resourceLoader = new ResourceLoader();
                $rlContext = new ResourceLoaderContext( $resourceLoader, new FauxRequest( array(
                                'debug' => 'true',
                                'lang' => $this->getLanguageCode(),
                                'only' => 'styles',
-                               'skin' => 'vector',
                ) ) );
+
+               $styles = array();
                foreach ( $moduleNames as $moduleName ) {
                        /** @var ResourceLoaderFileModule $module */
                        $module = $resourceLoader->getModule( $moduleName );
-                       // One of the modules will be missing if Vector is unavailable
-                       if ( !$module ) {
-                               continue;
-                       }
 
                        // Based on: ResourceLoaderFileModule::getStyles (without the DB query)
-                       $styles = ResourceLoader::makeCombinedStyles( $module->readStyleFiles(
-                               $module->getStyleFiles( $rlContext ),
-                               $module->getFlip( $rlContext )
-                       ) );
-
-                       $css .= implode( "\n", $styles );
+                       $styles = array_merge( $styles, ResourceLoader::makeCombinedStyles(
+                               $module->readStyleFiles(
+                                       $module->getStyleFiles( $rlContext ),
+                                       $module->getFlip( $rlContext )
+                       ) ) );
                }
 
-               return $css;
+               return implode( "\n", $styles );
        }
 
        /**
@@ -225,7 +227,7 @@ class WebInstallerOutput {
        public function getHeadAttribs() {
                return array(
                        'dir' => $this->getDir(),
-                       'lang' => $this->getLanguageCode(),
+                       'lang' => wfBCP47( $this->getLanguageCode() ),
                );
        }
 
@@ -271,8 +273,8 @@ class WebInstallerOutput {
 <?php echo Html::openElement( 'body', array( 'class' => $this->getDir() ) ) . "\n"; ?>
 <div id="mw-page-base"></div>
 <div id="mw-head-base"></div>
-<div id="content">
-<div id="bodyContent">
+<div id="content" class="mw-body">
+<div id="bodyContent" class="mw-body-content">
 
 <h1><?php $this->outputTitle(); ?></h1>
 <?php