Anomie has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/399910 )
Change subject: Use 'unwrap' post-cache transform instead of
setWrapOutputClass( false ), when available
......................................................................
Use 'unwrap' post-cache transform instead of setWrapOutputClass( false ), when
available
To reduce parser cache fragmentation, core is deprecating
$parserOptions->setWrapOutputClass( false ) in favor of
$parserOutput->getText( [ 'unwrap' => true ] );
Change-Id: Ibfaefde2f3811151ec712554cbc9cf2415ed017f
---
M includes/api/ApiMobileView.php
M tests/phpunit/api/ApiMobileViewTest.php
2 files changed, 10 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/10/399910/1
diff --git a/includes/api/ApiMobileView.php b/includes/api/ApiMobileView.php
index c3380c9..81496f4 100644
--- a/includes/api/ApiMobileView.php
+++ b/includes/api/ApiMobileView.php
@@ -478,7 +478,9 @@
*/
protected function makeParserOptions( WikiPage $wp ) {
$popt = $wp->makeParserOptions( $this );
- if ( is_callable( [ $popt, 'setWrapOutputClass' ] ) ) {
+ if ( is_callable( [ $popt, 'setWrapOutputClass' ] )
+ !defined( 'ParserOutput::SUPPORTS_UNWRAP_TRANSFORM' )
+ ) {
// Let the client handle it.
$popt->setWrapOutputClass( false );
}
@@ -618,7 +620,7 @@
$this->dieWithError(
'apierror-mobilefrontend-badidtitle', 'invalidparams' );
return;
}
- $html = $parserOutput->getText( [ 'allowTOC' => false ]
);
+ $html = $parserOutput->getText( [ 'allowTOC' => false,
'unwrap' => true ] );
$cacheExpiry = $parserOutput->getCacheExpiry();
}
diff --git a/tests/phpunit/api/ApiMobileViewTest.php
b/tests/phpunit/api/ApiMobileViewTest.php
index 32dae27..f761ca4 100644
--- a/tests/phpunit/api/ApiMobileViewTest.php
+++ b/tests/phpunit/api/ApiMobileViewTest.php
@@ -25,7 +25,9 @@
if ( !defined( 'ParserOutput::SUPPORTS_STATELESS_TRANSFORMS' )
) {
$po->setTOCEnabled( false );
}
- $po->setText( str_replace( [ "\r", "\n" ], '', $po->getText( [
'allowTOC' => false ] ) ) );
+ $po->setText( str_replace( [ "\r", "\n" ], '', $po->getText( [
+ 'allowTOC' => false, 'unwrap' => true,
+ ] ) ) );
return $po;
}
@@ -36,7 +38,9 @@
protected function makeParserOptions( WikiPage $wp ) {
$popt = new ParserOptions( $this->getUser() );
- if ( is_callable( [ $popt, 'setWrapOutputClass' ] ) ) {
+ if ( is_callable( [ $popt, 'setWrapOutputClass' ] )
+ !defined( 'ParserOutput::SUPPORTS_UNWRAP_TRANSFORM' )
+ ) {
// Let the client handle it.
$popt->setWrapOutputClass( false );
}
--
To view, visit https://gerrit.wikimedia.org/r/399910
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibfaefde2f3811151ec712554cbc9cf2415ed017f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits