From 85e1525862d65ccd66d10bf21cbb2bc0e4bb8d8d Mon Sep 17 00:00:00 2001 From: "C. Scott Ananian" Date: Wed, 1 Apr 2020 17:36:23 -0400 Subject: [PATCH] Deprecate ParserOptions::getTidy() and ParserOptions::setTidy() These options no longer have any effect. Bug: T198214 Change-Id: Icc3eaed7ab8a3070c4339b272d580328ba40912d --- RELEASE-NOTES-1.35 | 2 ++ includes/OutputPage.php | 3 +-- includes/cache/MessageCache.php | 3 --- includes/installer/Installer.php | 1 - includes/parser/ParserOptions.php | 2 ++ includes/specials/SpecialExpandTemplates.php | 1 - 6 files changed, 5 insertions(+), 7 deletions(-) diff --git a/RELEASE-NOTES-1.35 b/RELEASE-NOTES-1.35 index b4c67c1508a..3232fc19ca2 100644 --- a/RELEASE-NOTES-1.35 +++ b/RELEASE-NOTES-1.35 @@ -896,6 +896,8 @@ because of Phabricator reports. * Parser::firstCallInit() has been deprecated. The parser is initialized fully on construction and so ::firstCallInit() no longer has any effect when manually invoked. +* ParserOptions::getTidy() and ParserOptions::setTidy() have been deprecated. + These options no longer have any effect. * Version 1 of the parserTests file format has been deprecated. Update your parser tests to version 2, which uses Remex tidy on all test output by default. diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 0c7e1e04521..b11351d3e1f 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2091,7 +2091,7 @@ class OutputPage extends ContextSource { } $popts = $this->parserOptions(); - $oldTidy = $popts->setTidy( true ); + $oldInterface = $popts->setInterfaceMessage( (bool)$interface ); $parserOutput = MediaWikiServices::getInstance()->getParser()->getFreshParser()->parse( @@ -2099,7 +2099,6 @@ class OutputPage extends ContextSource { $linestart, true, $this->mRevisionId ); - $popts->setTidy( $oldTidy ); $popts->setInterfaceMessage( $oldInterface ); return $parserOutput; diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index d8972de2464..42500e1af3b 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -210,7 +210,6 @@ class MessageCache implements LoggerAwareInterface { // either. $po = ParserOptions::newFromAnon(); $po->setAllowUnsafeRawHtml( false ); - $po->setTidy( true ); return $po; } @@ -219,8 +218,6 @@ class MessageCache implements LoggerAwareInterface { // from malicious sources. As a precaution, disable // the parser tag when parsing messages. $this->mParserOptions->setAllowUnsafeRawHtml( false ); - // For the same reason, tidy the output! - $this->mParserOptions->setTidy( true ); } return $this->mParserOptions; diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 5ded811f107..40f2d4ee1c5 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -462,7 +462,6 @@ abstract class Installer { $this->parserTitle = Title::newFromText( 'Installer' ); $this->parserOptions = new ParserOptions( $wgUser ); // language will be wrong :( - $this->parserOptions->setTidy( true ); // Don't try to access DB before user language is initialised $this->setParserLanguage( $mwServices->getLanguageFactory()->getLanguage( 'en' ) ); } diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php index e23c8a5781a..a4ab95dc24d 100644 --- a/includes/parser/ParserOptions.php +++ b/includes/parser/ParserOptions.php @@ -292,6 +292,7 @@ class ParserOptions { /** * Use tidy to cleanup output HTML? * @return bool + * @deprecated since 1.35; tidy is always enabled */ public function getTidy() { return $this->getOption( 'tidy' ); @@ -301,6 +302,7 @@ class ParserOptions { * Use tidy to cleanup output HTML? * @param bool|null $x New value (null is no change) * @return bool Old value + * @deprecated since 1.35; tidy is always enabled so this has no effect */ public function setTidy( $x ) { if ( !$x ) { diff --git a/includes/specials/SpecialExpandTemplates.php b/includes/specials/SpecialExpandTemplates.php index 6c266cd9722..4b365dcba38 100644 --- a/includes/specials/SpecialExpandTemplates.php +++ b/includes/specials/SpecialExpandTemplates.php @@ -74,7 +74,6 @@ class SpecialExpandTemplates extends SpecialPage { $this->removeNowiki = $request->getBool( 'wpRemoveNowiki', false ); $options = ParserOptions::newFromContext( $this->getContext() ); $options->setRemoveComments( $this->removeComments ); - $options->setTidy( true ); $options->setMaxIncludeSize( self::MAX_INCLUDE_SIZE ); $parser = MediaWikiServices::getInstance()->getParser();