[MediaWiki-commits] [Gerrit] mediawiki...ParsoidBatchAPI[master]: Use 'unwrap' post-cache transform instead of setWrapOutputCl...

2017-12-22 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/399911 )

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: I55048bbae5d4d2d0c79c241c1784448b82db3bb4
---
M includes/ApiParsoidBatch.php
1 file changed, 4 insertions(+), 2 deletions(-)

Approvals:
  Subramanya Sastry: Looks good to me, approved
  Gergő Tisza: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/ApiParsoidBatch.php b/includes/ApiParsoidBatch.php
index 7bbf4e9..cc5b95b 100644
--- a/includes/ApiParsoidBatch.php
+++ b/includes/ApiParsoidBatch.php
@@ -241,12 +241,14 @@
$contentHandler = ContentHandler::getForModelID( 
CONTENT_MODEL_WIKITEXT );
$options = $contentHandler->makeParserOptions( 
$this->getContext() );
$options->enableLimitReport( false );
-   if ( is_callable( [ $options, 'setWrapOutputClass' ] ) ) {
+   if ( is_callable( [ $options, 'setWrapOutputClass' ] ) &&
+   !defined( 'ParserOutput::SUPPORTS_UNWRAP_TRANSFORM' )
+   ) {
$options->setWrapOutputClass( false ); // Parsoid 
doesn't want the output wrapper
}
$out = $wgParser->parse( $text, $title, $options, true, true, 
$revid );
return [
-   'text' => $out->getText(),
+   'text' => $out->getText( [ 'unwrap' => true ] ),
'modules' => array_values( array_unique( 
$out->getModules() ) ),
'modulescripts' => array_values( array_unique( 
$out->getModuleScripts() ) ),
'modulestyles' => array_values( array_unique( 
$out->getModuleStyles() ) ),

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I55048bbae5d4d2d0c79c241c1784448b82db3bb4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ParsoidBatchAPI
Gerrit-Branch: master
Gerrit-Owner: Anomie 
Gerrit-Reviewer: Gergő Tisza 
Gerrit-Reviewer: Subramanya Sastry 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] mediawiki...ParsoidBatchAPI[master]: Use 'unwrap' post-cache transform instead of setWrapOutputCl...

2017-12-22 Thread Anomie (Code Review)
Anomie has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/399911 )

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: I55048bbae5d4d2d0c79c241c1784448b82db3bb4
---
M includes/ApiParsoidBatch.php
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ParsoidBatchAPI 
refs/changes/11/399911/1

diff --git a/includes/ApiParsoidBatch.php b/includes/ApiParsoidBatch.php
index 7bbf4e9..cc5b95b 100644
--- a/includes/ApiParsoidBatch.php
+++ b/includes/ApiParsoidBatch.php
@@ -241,12 +241,14 @@
$contentHandler = ContentHandler::getForModelID( 
CONTENT_MODEL_WIKITEXT );
$options = $contentHandler->makeParserOptions( 
$this->getContext() );
$options->enableLimitReport( false );
-   if ( is_callable( [ $options, 'setWrapOutputClass' ] ) ) {
+   if ( is_callable( [ $options, 'setWrapOutputClass' ] ) &&
+   !defined( 'ParserOutput::SUPPORTS_UNWRAP_TRANSFORM' )
+   ) {
$options->setWrapOutputClass( false ); // Parsoid 
doesn't want the output wrapper
}
$out = $wgParser->parse( $text, $title, $options, true, true, 
$revid );
return [
-   'text' => $out->getText(),
+   'text' => $out->getText( [ 'unwrap' => true ] ),
'modules' => array_values( array_unique( 
$out->getModules() ) ),
'modulescripts' => array_values( array_unique( 
$out->getModuleScripts() ) ),
'modulestyles' => array_values( array_unique( 
$out->getModuleStyles() ) ),

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I55048bbae5d4d2d0c79c241c1784448b82db3bb4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ParsoidBatchAPI
Gerrit-Branch: master
Gerrit-Owner: Anomie 

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