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

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

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



diff --git a/includes/ApiQueryExtracts.php b/includes/ApiQueryExtracts.php
index 9b0e845..f4470e6 100644
--- a/includes/ApiQueryExtracts.php
+++ b/includes/ApiQueryExtracts.php
@@ -219,7 +219,9 @@
                $apiException = null;
                if ( !$this->parserOptions ) {
                        $this->parserOptions = new ParserOptions( new User( 
'127.0.0.1' ) );
-                       if ( is_callable( [ $this->parserOptions, 
'setWrapOutputClass' ] ) ) {
+                       if ( is_callable( [ $this->parserOptions, 
'setWrapOutputClass' ] ) &&
+                               !defined( 
'ParserOutput::SUPPORTS_UNWRAP_TRANSFORM' )
+                       ) {
                                $this->parserOptions->setWrapOutputClass( false 
);
                        }
                }
@@ -227,7 +229,7 @@
                if ( $page->shouldCheckParserCache( $this->parserOptions, 0 ) ) 
{
                        $pout = 
MediaWikiServices::getInstance()->getParserCache()->get( $page, 
$this->parserOptions );
                        if ( $pout ) {
-                               $text = $pout->getText();
+                               $text = $pout->getText( [ 'unwrap' => true ] );
                                if ( $this->params['intro'] ) {
                                        $text = $this->getFirstSection( $text, 
false );
                                }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibc013a41f4a463f4014fbbce7ce27f8690161728
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TextExtracts
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
Gerrit-Reviewer: GergÅ‘ Tisza <[email protected]>
Gerrit-Reviewer: MaxSem <[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