[MediaWiki-commits] [Gerrit] Fix parser cache issues - change (mediawiki...MobileFrontend)
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 Gerrit-Reviewer: MaxSem Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix parser cache issues - change (mediawiki...MobileFrontend)
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 --- M extension.json M includes/MobileFrontend.hooks.php 2 files changed, 23 insertions(+), 2 deletions(-) Approvals: MaxSem: Looks good to me, approved jenkins-bot: Verified diff --git a/extension.json b/extension.json index 7d66b9d..00ddc99 100644 --- a/extension.json +++ b/extension.json @@ -1815,6 +1815,9 @@ "MediaWikiPerformAction": [ "MobileFrontendHooks::onMediaWikiPerformAction" ], + "OutputPageBeforeHTML": [ + "MobileFrontendHooks::onOutputPageBeforeHTML" + ], "SkinTemplateOutputPageBeforeExec": [ "MobileFrontendHooks::onSkinTemplateOutputPageBeforeExec" ], diff --git a/includes/MobileFrontend.hooks.php b/includes/MobileFrontend.hooks.php index 7e72b4c..63e0dbd 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 * @@ -1237,8 +1256,7 @@ } } } - // Enable wrapped sections - $po->setText( ExtMobileFrontend::DOMParse( $outputPage, $po->getText(), $isBeta ) ); + } return true; } -- To view, visit https://gerrit.wikimedia.org/r/276009 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.15 Gerrit-Owner: Jdlrobson Gerrit-Reviewer: Jdlrobson Gerrit-Reviewer: MaxSem Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix parser cache issues - change (mediawiki...MobileFrontend)
Jdlrobson has uploaded a new change for review. https://gerrit.wikimedia.org/r/276057 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(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/57/276057/1 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: newchange Gerrit-Change-Id: I2b2aa15bee73454b1abc238c3413d30cdaa49f2c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: wmf/1.27.0-wmf.16 Gerrit-Owner: Jdlrobson ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix parser cache issues - change (mediawiki...MobileFrontend)
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 --- M extension.json M includes/MobileFrontend.hooks.php 2 files changed, 22 insertions(+), 2 deletions(-) Approvals: BryanDavis: Looks good to me, approved Jdlrobson: Looks good to me, approved jenkins-bot: Verified diff --git a/extension.json b/extension.json index 220e0ad..9fb32ae 100644 --- a/extension.json +++ b/extension.json @@ -1818,6 +1818,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/266337 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2b2aa15bee73454b1abc238c3413d30cdaa49f2c Gerrit-PatchSet: 17 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: master Gerrit-Owner: Jdlrobson Gerrit-Reviewer: Bartosz DziewoĆski Gerrit-Reviewer: BryanDavis Gerrit-Reviewer: Florianschmidtwelzow Gerrit-Reviewer: Jdlrobson Gerrit-Reviewer: Krinkle Gerrit-Reviewer: Legoktm Gerrit-Reviewer: MaxSem Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix parser cache issues - change (mediawiki...MobileFrontend)
Jdlrobson has uploaded a new change for review. https://gerrit.wikimedia.org/r/276009 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 --- M extension.json M includes/MobileFrontend.hooks.php 2 files changed, 23 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend refs/changes/09/276009/1 diff --git a/extension.json b/extension.json index 7d66b9d..00ddc99 100644 --- a/extension.json +++ b/extension.json @@ -1815,6 +1815,9 @@ "MediaWikiPerformAction": [ "MobileFrontendHooks::onMediaWikiPerformAction" ], + "OutputPageBeforeHTML": [ + "MobileFrontendHooks::onOutputPageBeforeHTML" + ], "SkinTemplateOutputPageBeforeExec": [ "MobileFrontendHooks::onSkinTemplateOutputPageBeforeExec" ], diff --git a/includes/MobileFrontend.hooks.php b/includes/MobileFrontend.hooks.php index 7e72b4c..63e0dbd 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 * @@ -1237,8 +1256,7 @@ } } } - // Enable wrapped sections - $po->setText( ExtMobileFrontend::DOMParse( $outputPage, $po->getText(), $isBeta ) ); + } return true; } -- To view, visit https://gerrit.wikimedia.org/r/276009 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2b2aa15bee73454b1abc238c3413d30cdaa49f2c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MobileFrontend Gerrit-Branch: wmf/1.27.0-wmf.15 Gerrit-Owner: Jdlrobson ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits