jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/364230 )

Change subject: Hygiene: Remove wgMFTidyMobileViewSections
......................................................................


Hygiene: Remove wgMFTidyMobileViewSections

wgMFTidyMobileViewSections was unconditionally set to false on all
production wikis in I35bdf93b. The concern that the apps could handle
untidy (imbalanced) HTML in the mobileview response is now moot as they
consume the Mobile Content Service family of services, which transform
and return valid HTML5 from Parsoid.

Additional changes:
* Remove Tidy related test from the APIParseExtender tests as
  MobileFrontend uses Tidy and so it's odd to (dis)prove that it works
  both with and without it.

Bug: T168671
Change-Id: I4c8f5437dc25eec8f1ea1d87468ca01566460334
---
M README.md
M extension.json
M includes/api/ApiMobileView.php
M tests/phpunit/api/ApiParseExtenderTest.php
4 files changed, 2 insertions(+), 28 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jdlrobson: Looks good to me, approved



diff --git a/README.md b/README.md
index d6f7a38..4569ab7 100644
--- a/README.md
+++ b/README.md
@@ -219,14 +219,6 @@
 * Type: `Boolean`
 * Default: `false`
 
-#### $wgMFTidyMobileViewSections
-
-Controls whether API `action=mobileview` should have every HTML section tidied
-for invalid markup.
-
-* Type: `Boolean`
-* Default: `true`
-
 #### $wgMFMobileHeader
 
 Requests containing header with this name will be considered as coming from
diff --git a/extension.json b/extension.json
index 1abf146..95c150e 100644
--- a/extension.json
+++ b/extension.json
@@ -1775,7 +1775,6 @@
                ],
                "MFSpecialCaseMainPage": false,
                "MinervaEnableSiteNotice": false,
-               "MFTidyMobileViewSections": true,
                "MFMobileHeader": "X-Subdomain",
                "MFRemovableClasses": {
                        "beta": [],
diff --git a/includes/api/ApiMobileView.php b/includes/api/ApiMobileView.php
index bec4f2c..daa6ca4 100644
--- a/includes/api/ApiMobileView.php
+++ b/includes/api/ApiMobileView.php
@@ -495,7 +495,6 @@
         * @param string $html representing the entire page
         * @param Title $title
         * @param ParserOutput $parserOutput
-        * @param boolean $useTidy whether the provided HTML should be tidied 
(optional)
         * @param integer $revId this is a temporary parameter to avoid debug 
log warnings.
         *  Long term the call to wfDebugLog should be moved outside this 
method (optional)
         * @return array structure representing the list of sections and their 
properties:
@@ -505,9 +504,7 @@
         *  - text: [] of the text of each individual section. length === same 
as sections
         *      or of length 1 when there is a mismatch.
         */
-       protected function parseSectionsData( $html, Title $title, ParserOutput 
$parserOutput,
-               $useTidy = false, $revId = null
-       ) {
+       protected function parseSectionsData( $html, Title $title, ParserOutput 
$parserOutput, $revId = null ) {
                $data = [];
                $data['sections'] = $parserOutput->getSections();
                $sectionCount = count( $data['sections'] );
@@ -528,9 +525,6 @@
                foreach ( $chunks as $chunk ) {
                        if ( count( $data['text'] ) ) {
                                $chunk = "<h$chunk";
-                       }
-                       if ( $useTidy && count( $chunks ) > 1 ) {
-                               $chunk = MWTidy::tidy( $chunk );
                        }
                        if ( preg_match( '/<ol\b[^>]*?class="references"/', 
$chunk ) ) {
                                $data['refsections'][count( $data['text'] )] = 
true;
@@ -645,9 +639,7 @@
                                'refsections' => [],
                        ];
                } else {
-                       $useTidy = $this->getConfig()->get( 'TidyConfig' ) !== 
null
-                               && $mfConfig->get( 'MFTidyMobileViewSections' );
-                       $data = $this->parseSectionsData( $html, $title, 
$parserOutput, $useTidy, $latest );
+                       $data = $this->parseSectionsData( $html, $title, 
$parserOutput, $latest );
                        if ( $this->usePageImages ) {
                                $image = $this->getPageImage( $title );
                                if ( $image ) {
diff --git a/tests/phpunit/api/ApiParseExtenderTest.php 
b/tests/phpunit/api/ApiParseExtenderTest.php
index f52323d..59fed1b 100644
--- a/tests/phpunit/api/ApiParseExtenderTest.php
+++ b/tests/phpunit/api/ApiParseExtenderTest.php
@@ -14,20 +14,11 @@
         * @covers ApiParseExtender::onAPIAfterExecute
         */
        public function testApi( array $params, $expected ) {
-               global $wgTidyConfig;
-
                $this->setMwGlobals( 'wgMFRemovableClasses',
                        [
                                'base' => [ '.nomobile' ]
                        ]
                );
-               if ( $wgTidyConfig !== null ) {
-                       $oldTidyConfig = $wgTidyConfig;
-                       // Should work both with Tidy and without it
-                       $this->setMwGlobals( 'wgTidyConfig', null );
-                       $this->doTest( $params, $expected );
-                       $wgTidyConfig = $oldTidyConfig;
-               }
                $this->doTest( $params, $expected );
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/364230
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I4c8f5437dc25eec8f1ea1d87468ca01566460334
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Phuedx <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Pmiazga <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to