Deprecate ParserOptions::getTidy() and ParserOptions::setTidy()

These options no longer have any effect.

Bug: T198214
Change-Id: Icc3eaed7ab8a3070c4339b272d580328ba40912d
This commit is contained in:
C. Scott Ananian 2020-04-01 17:36:23 -04:00 committed by James D. Forrester
parent cedee2b620
commit 85e1525862
6 changed files with 5 additions and 7 deletions

View file

@ -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.

View file

@ -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;

View file

@ -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 <html> parser tag when parsing messages.
$this->mParserOptions->setAllowUnsafeRawHtml( false );
// For the same reason, tidy the output!
$this->mParserOptions->setTidy( true );
}
return $this->mParserOptions;

View file

@ -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' ) );
}

View file

@ -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 ) {

View file

@ -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();