X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Finstaller%2FWebInstallerOutput.php;h=b061d0da36e60ceffd98c60d71de93719223c080;hb=1404a1f6bf6065035e74c287951b1c2126f11e55;hp=dd76ce9242f0998e8cd247c4492e38f1979f8ba0;hpb=8df18bbd1362002f821727bf5db4291c4d9a7b08;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/installer/WebInstallerOutput.php b/includes/installer/WebInstallerOutput.php index dd76ce9242..b061d0da36 100644 --- a/includes/installer/WebInstallerOutput.php +++ b/includes/installer/WebInstallerOutput.php @@ -21,6 +21,8 @@ * @ingroup Deployment */ +use MediaWiki\MediaWikiServices; + /** * Output class modelled on OutputPage. * @@ -31,6 +33,7 @@ * * @ingroup Deployment * @since 1.17 + * @private */ class WebInstallerOutput { @@ -89,17 +92,18 @@ class WebInstallerOutput { /** * @param string $text - * @deprecated since 1.32; use addWikiTextInterface instead + * @deprecated since 1.32; use addWikiTextAsInterface instead */ public function addWikiText( $text ) { wfDeprecated( __METHOD__, '1.32' ); - $this->addWikiTextInterface( $text ); + $this->addWikiTextAsInterface( $text ); } /** * @param string $text + * @since 1.32 */ - public function addWikiTextInterface( $text ) { + public function addWikiTextAsInterface( $text ) { $this->addHTML( $this->parent->parse( $text ) ); } @@ -145,7 +149,7 @@ class WebInstallerOutput { 'mediawiki.skinning.interface', ]; - $resourceLoader = new ResourceLoader(); + $resourceLoader = MediaWikiServices::getInstance()->getResourceLoader(); if ( file_exists( "$wgStyleDirectory/Vector/skin.json" ) ) { // Force loading Vector skin if available as a fallback skin @@ -165,7 +169,7 @@ class WebInstallerOutput { $rlContext = new ResourceLoaderContext( $resourceLoader, new FauxRequest( [ 'debug' => 'true', - 'lang' => $this->getLanguageCode(), + 'lang' => $this->getLanguage()->getCode(), 'only' => 'styles', ] ) ); @@ -196,7 +200,7 @@ class WebInstallerOutput { * @return string */ private function getCssUrl() { - return Html::linkedStyle( $_SERVER['PHP_SELF'] . '?css=1' ); + return Html::linkedStyle( $this->parent->getUrl( [ 'css' => 1 ] ) ); } public function useShortHeader( $use = true ) { @@ -219,21 +223,13 @@ class WebInstallerOutput { } /** - * @return string - */ - public function getDir() { - global $wgLang; - - return is_object( $wgLang ) ? $wgLang->getDir() : 'ltr'; - } - - /** - * @return string + * @since 1.33 + * @return Language */ - public function getLanguageCode() { + private function getLanguage() { global $wgLang; - return is_object( $wgLang ) ? $wgLang->getCode() : 'en'; + return is_object( $wgLang ) ? $wgLang : Language::factory( 'en' ); } /** @@ -241,8 +237,8 @@ class WebInstallerOutput { */ public function getHeadAttribs() { return [ - 'dir' => $this->getDir(), - 'lang' => LanguageCode::bcp47( $this->getLanguageCode() ), + 'dir' => $this->getLanguage()->getDir(), + 'lang' => $this->getLanguage()->getHtmlCode(), ]; } @@ -286,7 +282,7 @@ class WebInstallerOutput { - $this->getDir() ] ) . "\n"; ?> + $this->getLanguage()->getDir() ] ) . "\n"; ?>