Replace deprecated calls to OutputPage::parseInline()
authorC. Scott Ananian <cscott@cscott.net>
Fri, 26 Oct 2018 15:39:07 +0000 (11:39 -0400)
committerC. Scott Ananian <cscott@cscott.net>
Mon, 29 Oct 2018 19:34:43 +0000 (15:34 -0400)
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

includes/ProtectionForm.php
includes/preferences/DefaultPreferencesFactory.php
includes/specials/SpecialVersion.php

index 0d0654e..bb8eba1 100644 (file)
@@ -317,7 +317,7 @@ class ProtectionForm {
                );
 
                if ( !$status->isOK() ) {
-                       $this->show( $out->parseInline( $status->getWikiText() ) );
+                       $this->show( $out->parseInlineAsInterface( $status->getWikiText() ) );
                        return false;
                }
 
index ad45211..3ec6876 100644 (file)
@@ -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,
index 4e9245f..c99a422 100644 (file)
@@ -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 );
                        }
                }