Hard-deprecate the $wgUseTidy option
authorC. Scott Ananian <cscott@cscott.net>
Tue, 26 Jun 2018 13:35:26 +0000 (09:35 -0400)
committerC. Scott Ananian <cscott@cscott.net>
Thu, 20 Sep 2018 15:08:40 +0000 (11:08 -0400)
This has been soft-deprecated since MW 1.26; this hard-deprecation
sets the stage for future removal of this old cruft.

Bug: T198214
Depends-On: Idf246d05d116f63a73105b50a1929a7721fbe7b9
Change-Id: I2e7d990da1da378eb6e828d4b3c0f5a41791dd92

RELEASE-NOTES-1.32
docs/distributors.txt
includes/DefaultSettings.php
includes/parser/MWTidy.php
maintenance/compareParsers.php
tests/phpunit/includes/content/TextContentTest.php

index 5954b87..de091ca 100644 (file)
@@ -445,6 +445,10 @@ because of Phabricator reports.
 * Content::getDeletionUpdates has been deprecated in favor of
   ContentHandler::getDeletionUpdates() for overriding by extensions (T194038).
   Application logic should call WikiPage::doSecondaryDataUpdates() (T194037).
+* (T198214) Old Tidy-related configuration settings, which were soft-deprecated
+  in MediaWiki 1.26, have now been hard deprecated. This affects $wgUseTidy,
+  $wgTidyBin, $wgTidyConf, $wgTidyOpts, $wgTidyInternal, and $wgDebugTidy. Use
+  $wgTidyConfig instead.
 
 === Other changes in 1.32 ===
 * (T198811) The following tables have had their UNIQUE indexes turned into
index 729dffa..f2af458 100644 (file)
@@ -174,8 +174,6 @@ perhaps configure it to use them (see Configuration section of this document):
   "$wgAntivirus = 'clamav';".
   * DjVuLibre: Allows processing of DjVu files. To enable this, set
   "$wgDjvuDump = 'djvudump'; $wgDjvuRenderer = 'ddjvu'; $wgDjvuTxt = 'djvutxt';".
-  * HTML Tidy: Fixes errors in HTML at runtime. Can be enabled with
-       "$wgUseTidy = true;".
   * ImageMagick: For resizing images. "$wgUseImageMagick = true;" will enable
   it. PHP's GD can also be used, but ImageMagick is preferable.
   * HTTP cache such as Varnish or Squid: can provide a drastic speedup and a
index ab67225..0fa2a9f 100644 (file)
@@ -4267,10 +4267,13 @@ $wgAllowImageTag = false;
  * library; historically, Dave Raggett's "HTML Tidy" was typically used.
  * See https://www.w3.org/People/Raggett/tidy/
  *
+ * Setting this to null is deprecated.
+ *
  * If this is null and $wgUseTidy is true, the deprecated configuration
  * parameters will be used instead.
  *
  * If this is null and $wgUseTidy is false, a pure PHP fallback will be used.
+ * (Equivalent to setting `$wgTidyConfig['driver'] = 'disabled'`.)
  *
  * Keys are:
  *  - driver: May be:
@@ -4278,6 +4281,8 @@ $wgAllowImageTag = false;
  *    - RaggettInternalPHP: Use the PECL extension
  *    - RaggettExternal: Shell out to an external binary (tidyBin)
  *    - RemexHtml: Use the RemexHtml library in PHP
+ *    - disabled: Disable tidy pass and use a hacky pure PHP workaround
+ *      (this is what setting $wgUseTidy to false used to do)
  *
  *  - tidyConfigFile: Path to configuration file for any of the Raggett drivers
  *  - debugComment: True to add a comment to the output with warning messages
@@ -4288,37 +4293,38 @@ $wgTidyConfig = [ 'driver' => 'RemexHtml' ];
 
 /**
  * Set this to true to use the deprecated tidy configuration parameters.
- * @deprecated use $wgTidyConfig
+ * @deprecated since 1.26, use $wgTidyConfig['driver'] = 'disabled'
  */
 $wgUseTidy = false;
 
 /**
  * The path to the tidy binary.
- * @deprecated Use $wgTidyConfig['tidyBin']
+ * @deprecated since 1.26, use $wgTidyConfig['tidyBin']
  */
 $wgTidyBin = 'tidy';
 
 /**
  * The path to the tidy config file
- * @deprecated Use $wgTidyConfig['tidyConfigFile']
+ * @deprecated since 1.26, use $wgTidyConfig['tidyConfigFile']
  */
 $wgTidyConf = $IP . '/includes/tidy/tidy.conf';
 
 /**
  * The command line options to the tidy binary
- * @deprecated Use $wgTidyConfig['tidyCommandLine']
+ * @deprecated since 1.26, use $wgTidyConfig['tidyCommandLine']
  */
 $wgTidyOpts = '';
 
 /**
  * Set this to true to use the tidy extension
- * @deprecated Use $wgTidyConfig['driver']
+ * @deprecated since 1.26, use $wgTidyConfig['driver']
  */
 $wgTidyInternal = extension_loaded( 'tidy' );
 
 /**
  * Put tidy warnings in HTML comments
  * Only works for internal tidy.
+ * @deprecated since 1.26, use $wgTidyConfig['debugComment']
  */
 $wgDebugTidy = false;
 
index 5788986..a73c28c 100644 (file)
@@ -71,6 +71,7 @@ class MWTidy {
                                $config = $wgTidyConfig;
                        } elseif ( $wgUseTidy ) {
                                // b/c configuration
+                               wfDeprecated( '$wgUseTidy', '1.26' );
                                $config = [
                                        'tidyConfigFile' => $wgTidyConf,
                                        'debugComment' => $wgDebugTidy,
@@ -86,6 +87,7 @@ class MWTidy {
                                        $config['driver'] = 'RaggettExternal';
                                }
                        } else {
+                               wfDeprecated( '$wgTidyConfig = null and $wgUseTidy = false', '1.26' );
                                return false;
                        }
                        self::$instance = self::factory( $config );
index fe6e604..b01dde6 100644 (file)
@@ -95,9 +95,8 @@ class CompareParsers extends DumpIterator {
                $this->options = ParserOptions::newFromUser( $user );
 
                if ( $this->hasOption( 'tidy' ) ) {
-                       global $wgUseTidy;
-                       if ( !$wgUseTidy ) {
-                               $this->fatalError( 'Tidy was requested but $wgUseTidy is not set in LocalSettings.php' );
+                       if ( !MWTidy::isEnabled() ) {
+                               $this->fatalError( 'Tidy was requested but $wgTidyConfig is not set in LocalSettings.php' );
                        }
                        $this->options->setTidy( true );
                }
index d69cfd1..a890494 100644 (file)
@@ -32,7 +32,7 @@ class TextContentTest extends MediaWikiLangTestCase {
                                CONTENT_MODEL_CSS,
                                CONTENT_MODEL_JAVASCRIPT,
                        ],
-                       'wgUseTidy' => false,
+                       'wgTidyConfig' => [ 'driver' => 'disabled' ],
                        'wgCapitalLinks' => true,
                        'wgHooks' => [], // bypass hook ContentGetParserOutput that force custom rendering
                ] );