From 95c468f778973d1433e78b4287591d7d07aa8be3 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Thu, 4 Jul 2019 22:23:11 +0100 Subject: [PATCH] installer: Convert hack to raw message param Bug: T227297 Change-Id: I9a50342aa0c9525893085e1b8d428556f0262f5c --- includes/installer/WebInstaller.php | 16 +++++++--------- includes/installer/WebInstallerComplete.php | 6 +++--- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index b09455e963..82c1a69c1e 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -148,7 +148,6 @@ class WebInstaller extends Installer { // Add parser hooks $parser = MediaWikiServices::getInstance()->getParser(); - $parser->setHook( 'downloadlink', [ $this, 'downloadLinkHook' ] ); $parser->setHook( 'doclink', [ $this, 'docLink' ] ); } @@ -660,13 +659,15 @@ class WebInstaller extends Installer { /** * Get HTML for an information message box with an icon. * - * @param string $text Wikitext to be parsed (from Message::plain). + * @param string|HtmlArmor $text Wikitext to be parsed (from Message::plain) or raw HTML. * @param string|bool $icon Icon name, file in mw-config/images. Default: false * @param string|bool $class Additional class name to add to the wrapper div. Default: false. * @return string HTML */ public function getInfoBox( $text, $icon = false, $class = false ) { - $html = $this->parse( $text, true ); + $html = ( $text instanceof HtmlArmor ) ? + HtmlArmor::getHtml( $text ) : + $this->parse( $text, true ); $icon = ( $icon == false ) ? 'images/info-32.png' : 'images/' . $icon; @@ -1121,15 +1122,12 @@ class WebInstaller extends Installer { } /** - * Helper for "Download LocalSettings" link on WebInstall_Complete - * - * @param string $text Unused - * @param string[] $attribs Unused - * @param Parser $parser Unused + * Helper for "Download LocalSettings" link. * + * @internal For use in WebInstallerComplete class * @return string Html for download link */ - public function downloadLinkHook( $text, $attribs, $parser ) { + public function makeDownloadLinkHtml() { $anchor = Html::rawElement( 'a', [ 'href' => $this->getUrl( [ 'localsettings' => 1 ] ) ], wfMessage( 'config-download-localsettings' )->parse() diff --git a/includes/installer/WebInstallerComplete.php b/includes/installer/WebInstallerComplete.php index 685fa36744..2512efa7e3 100644 --- a/includes/installer/WebInstallerComplete.php +++ b/includes/installer/WebInstallerComplete.php @@ -45,13 +45,13 @@ class WebInstallerComplete extends WebInstallerPage { } $this->addHTML( $this->parent->getInfoBox( - wfMessage( $msg, + new HtmlArmor( wfMessage( $msg, $lsUrl, $this->getVar( 'wgServer' ) . $this->getVar( 'wgScriptPath' ) . '/index.php', - '', + Message::rawParam( $this->parent->makeDownloadLinkHtml() ), $location ?: '' - )->plain(), 'tick-32.png' + )->parse() ), 'tick-32.png' ) ); $this->addHTML( $this->parent->getInfoBox( -- 2.20.1