From: C. Scott Ananian Date: Fri, 26 Oct 2018 15:39:07 +0000 (-0400) Subject: Replace deprecated calls to OutputPage::parseInline() X-Git-Tag: 1.34.0-rc.0~3561^2~2 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=97d9659904424afe2c8b9df3c17438b051529f5e;p=lhc%2Fweb%2Fwiklou.git Replace deprecated calls to OutputPage::parseInline() Every one of these seemed to previously use the wrong value for `$interface` -- the interface messages in ProtectionForm and SpecialVersion were being parsed as content language (which is the default for `OutputPage::parseInline`), and the one place where we have actual data in the content language (the user signature, which gets parsed in the content language with the rest of the (talk) page content, see Parser.php::pstPass2) was being parsed as an interface message! Forcing the caller to be very explicit about AsContent() or AsInterface() will help mitigate this in the future, one hopes. Bug: T198214 Change-Id: Ib9d5d8d733a47c967bdf7db3e23fa39f11687063 --- diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index 0d0654e8fa..bb8eba125f 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -317,7 +317,7 @@ class ProtectionForm { ); if ( !$status->isOK() ) { - $this->show( $out->parseInline( $status->getWikiText() ) ); + $this->show( $out->parseInlineAsInterface( $status->getWikiText() ) ); return false; } diff --git a/includes/preferences/DefaultPreferencesFactory.php b/includes/preferences/DefaultPreferencesFactory.php index ad45211b55..3ec6876d79 100644 --- a/includes/preferences/DefaultPreferencesFactory.php +++ b/includes/preferences/DefaultPreferencesFactory.php @@ -463,7 +463,9 @@ class DefaultPreferencesFactory implements PreferencesFactory { $user, ParserOptions::newFromContext( $context ) ); - $oldsigHTML = $context->getOutput()->parseInline( $oldsigWikiText, true, true ); + $oldsigHTML = Parser::stripOuterParagraph( + $context->getOutput()->parseAsContent( $oldsigWikiText ) + ); $defaultPreferences['oldsig'] = [ 'type' => 'info', 'raw' => true, diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index 4e9245f318..c99a422e1f 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -716,7 +716,7 @@ class SpecialVersion extends SpecialPage { $vcsDate = null; if ( isset( $extension['version'] ) ) { - $canonicalVersion = $out->parseInline( $extension['version'] ); + $canonicalVersion = $out->parseInlineAsInterface( $extension['version'] ); } if ( isset( $extension['path'] ) ) { @@ -792,7 +792,7 @@ class SpecialVersion extends SpecialPage { if ( isset( $extension['name'] ) ) { $licenseName = null; if ( isset( $extension['license-name'] ) ) { - $licenseName = new HtmlArmor( $out->parseInline( $extension['license-name'] ) ); + $licenseName = new HtmlArmor( $out->parseInlineAsInterface( $extension['license-name'] ) ); } elseif ( $this->getExtLicenseFileName( $extensionPath ) ) { $licenseName = $this->msg( 'version-ext-license' )->text(); } @@ -829,7 +829,7 @@ class SpecialVersion extends SpecialPage { } else { $description = ''; } - $description = $out->parseInline( $description ); + $description = $out->parseInlineAsInterface( $description ); // ... now get the authors for this extension $authors = $extension['author'] ?? []; @@ -981,11 +981,11 @@ class SpecialVersion extends SpecialPage { $list[] = $text; } elseif ( substr( $item, -5 ) == ' ...]' ) { $hasOthers = true; - $list[] = $this->getOutput()->parseInline( + $list[] = $this->getOutput()->parseInlineAsInterface( substr( $item, 0, -4 ) . $this->msg( 'version-poweredby-others' )->text() . "]" ); } else { - $list[] = $this->getOutput()->parseInline( $item ); + $list[] = $this->getOutput()->parseInlineAsInterface( $item ); } }