Gerrit Patch Uploader has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/122327

Change subject: Add pst option to API difftotext Adds the option difftotextpst 
to ApiQueryRevisions.php, which will perform a pre-save transform on the 
supplied text, before diffing it against the requested revision.
......................................................................

Add pst option to API difftotext
Adds the option difftotextpst to ApiQueryRevisions.php, which will perform a 
pre-save transform on the supplied text, before diffing it against the 
requested revision.

Bug 51155

Change-Id: Ia480e8cd4ceeeb0b2812dc8ec96650adb83c03af
---
M includes/api/ApiQueryRevisions.php
1 file changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/27/122327/1

diff --git a/includes/api/ApiQueryRevisions.php 
b/includes/api/ApiQueryRevisions.php
index 033976f..bd6f30e 100644
--- a/includes/api/ApiQueryRevisions.php
+++ b/includes/api/ApiQueryRevisions.php
@@ -127,6 +127,7 @@
 
                if ( !is_null( $params['difftotext'] ) ) {
                        $this->difftotext = $params['difftotext'];
+                       $this->difftotextpst = $params['difftotextpst'];
                } elseif ( !is_null( $params['diffto'] ) ) {
                        if ( $params['diffto'] == 'cur' ) {
                                $params['diffto'] = 0;
@@ -653,6 +654,13 @@
                                                $this->contentFormat
                                        );
 
+                                       if ( $this->difftotextpst ) {
+                                               $page = WikiPage::factory( 
$title );
+                                               $popts = 
$page->makeParserOptions( $this->getContext() );
+
+                                               $difftocontent = 
$difftocontent->preSaveTransform( $title, $user, $popts );
+                                       }
+
                                        $engine = 
$handler->createDifferenceEngine( $context );
                                        $engine->setContent( $content, 
$difftocontent );
                                } else {
@@ -755,6 +763,7 @@
                        'continue' => null,
                        'diffto' => null,
                        'difftotext' => null,
+                       'difftotextpst' => false,
                        'contentformat' => array(
                                ApiBase::PARAM_TYPE => 
ContentHandler::getAllContentFormats(),
                                ApiBase::PARAM_DFLT => null
@@ -803,6 +812,10 @@
                                "Overrides {$p}diffto. If {$p}section is set, 
only that section will be",
                                'diffed against this text',
                        ),
+                       'difftotextpst' => array(
+                               'Do a pre-save transform on the text before 
diffing it',
+                               "Only valid when used with {$p}difftotext",
+                       ),
                        'tag' => 'Only list revisions tagged with this tag',
                        'contentformat' => 'Serialization format used for 
difftotext and expected for output of content',
                );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia480e8cd4ceeeb0b2812dc8ec96650adb83c03af
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Gerrit Patch Uploader <gerritpatchuploa...@gmail.com>
Gerrit-Reviewer: Gerrit Patch Uploader <gerritpatchuploa...@gmail.com>

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

Reply via email to