jenkins-bot has submitted this change and it was merged.
Change subject: Perf: Dont process post content when formatting recentchanges
......................................................................
Perf: Dont process post content when formatting recentchanges
Bug: T68505
Change-Id: I0e3d90a8371e162249c9634407c89915b16d8c8d
---
M includes/Formatter/RecentChanges.php
M includes/Formatter/RevisionFormatter.php
2 files changed, 17 insertions(+), 1 deletion(-)
Approvals:
Matthias Mullie: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/Formatter/RecentChanges.php
b/includes/Formatter/RecentChanges.php
index 3cf4f00..839fb9a 100644
--- a/includes/Formatter/RecentChanges.php
+++ b/includes/Formatter/RecentChanges.php
@@ -33,6 +33,8 @@
}
$this->serializer->setIncludeHistoryProperties( true );
+ $this->serializer->setIncludeContent( false );
+
$data = $this->serializer->formatApi( $row, $ctx );
if ( !$data ) {
throw new FlowException( 'Could not format data for row
' . $row->revision->getRevisionId()->getAlphadecimal() );
diff --git a/includes/Formatter/RevisionFormatter.php
b/includes/Formatter/RevisionFormatter.php
index 75b8f5a..7e686a2 100644
--- a/includes/Formatter/RevisionFormatter.php
+++ b/includes/Formatter/RevisionFormatter.php
@@ -59,6 +59,11 @@
protected $includeProperties = false;
/**
+ * @var bool
+ */
+ protected $includeContent = true;
+
+ /**
* @var string[]
*/
protected $allowedContentFormats = array( 'html', 'wikitext' );
@@ -129,6 +134,15 @@
$this->includeProperties = (bool)$shouldInclude;
}
+ /**
+ * Outputing content can be somehwat expensive, as most of the content
is loaded
+ * into DOMDocuemnts for processing of relidlinks and badimages. Set
this to false
+ * if the content will not be used such as for recent changes.
+ */
+ public function setIncludeContent( $shouldInclude ) {
+ $this->includeContent = (bool)$shouldInclude;
+ }
+
public function setContentFormat( $format, UUID $revisionId = null ) {
if ( false === array_search( $format,
$this->allowedContentFormats ) ) {
throw new FlowException( "Unknown content format:
$format" );
@@ -160,7 +174,7 @@
/** @noinspection PhpUnusedLocalVariableInspection */
$section = new \ProfileSection( __METHOD__ );
- $isContentAllowed = $this->permissions->isAllowed(
$row->revision, 'view' );
+ $isContentAllowed = $this->includeContent &&
$this->permissions->isAllowed( $row->revision, 'view' );
$isHistoryAllowed = $isContentAllowed ?:
$this->permissions->isAllowed( $row->revision, 'history' );
if ( !$isHistoryAllowed ) {
--
To view, visit https://gerrit.wikimedia.org/r/179060
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I0e3d90a8371e162249c9634407c89915b16d8c8d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Matthias Mullie <[email protected]>
Gerrit-Reviewer: SG <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits