jenkins-bot has submitted this change and it was merged.

Change subject: Fix parser cache issues
......................................................................


Fix parser cache issues

Mobile does not have a separate ParserOutput cache
Thus transformations such as removing the table of contents
and section collapsing have to occur later in the skin itself

Bug: T128702
Bug: T124356
Change-Id: I2b2aa15bee73454b1abc238c3413d30cdaa49f2c
(cherry picked from commit ab4c5c1bcc45d9c106e1df4f039a3c5fbfc480b6)
---
M extension.json
M includes/MobileFrontend.hooks.php
2 files changed, 22 insertions(+), 2 deletions(-)

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



diff --git a/extension.json b/extension.json
index 7d611ae..c773cbf 100644
--- a/extension.json
+++ b/extension.json
@@ -1825,6 +1825,9 @@
                "MediaWikiPerformAction": [
                        "MobileFrontendHooks::onMediaWikiPerformAction"
                ],
+               "OutputPageBeforeHTML": [
+                       "MobileFrontendHooks::onOutputPageBeforeHTML"
+               ],
                "SkinTemplateOutputPageBeforeExec": [
                        
"MobileFrontendHooks::onSkinTemplateOutputPageBeforeExec"
                ],
diff --git a/includes/MobileFrontend.hooks.php 
b/includes/MobileFrontend.hooks.php
index b102f08..17c6e55 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -183,6 +183,25 @@
        }
 
        /**
+        * OutputPageBeforeHTML hook handler
+        * @see https://www.mediawiki.org/wiki/Manual:Hooks/OutputPageBeforeHTML
+        *
+        * Applies MobileFormatter to mobile viewed content
+        *
+        * @param OutputPage $out
+        * @param string $text the HTML to be wrapped inside the 
#mw-content-text element
+        * @return bool
+        */
+       public static function onOutputPageBeforeHTML( &$out, &$text ) {
+               $context = MobileContext::singleton();
+               // Perform a few extra changes if we are in mobile mode
+               if ( $context->shouldDisplayMobileView() ) {
+                       $text = ExtMobileFrontend::DOMParse( $out, $text );
+               }
+               return true;
+       }
+
+       /**
         * BeforePageRedirect hook handler
         * @see https://www.mediawiki.org/wiki/Manual:Hooks/BeforePageRedirect
         *
@@ -1246,8 +1265,6 @@
                                        }
                                }
                        }
-                       // Enable wrapped sections
-                       $po->setText( ExtMobileFrontend::DOMParse( $outputPage, 
$po->getRawText(), $isBeta ) );
                }
                return true;
        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2b2aa15bee73454b1abc238c3413d30cdaa49f2c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: wmf/1.27.0-wmf.16
Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org>
Gerrit-Reviewer: MaxSem <maxsem.w...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to