Page MenuHomePhabricator

Add option to ApiQueryRevisions to do the pre-save transform on rvdifftotext before diffing
Closed, ResolvedPublic


This feature is in the parse API, allowing you to perform a pre-save transform on the text before parsing it.
This is useful for things such as AJAX diff previews, where currently you have to do a normal page-reloading preview if you want to see PST things such as subst templates and signatures, or make two API requests.


Related Gerrit Patches:
mediawiki/core : masterAdd pst option to API difftotext

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 1:43 AM
bzimport set Reference to bz51155.
bzimport added a subscriber: Unknown Object (MLST).
Majr created this task.Jul 11 2013, 2:53 AM

As stated, this request doesn't make any sense. The content being parsed by rvparse is what is already saved in the database, so it has already had the pre-save transform done on it before it was saved (hence the name "pre-save transform"). There's no reason to do the PST on it again.

But it seems like what you really want is an option to perform the PST on the text passed to rvdifftotext before doing the diff, which could make a sort of sense. But the option shouldn't be named "rvparsepst" or "rvparseonlypst", it should be named something like "rvdifftotextpst" to associate it with what it applies to. I've taken the liberty of changing the bug title accordingly; if you disagree, feel free to revert and we'll go from there.

Actually doing the PST then should be easy enough, you just need to call $difftocontent->preSaveTransform( ... ) in between creating $difftocontent and handing it off to the difference engine. All this is currently around line 600 of ApiQueryRevisions.php.

Majr added a comment.Jul 11 2013, 2:22 PM

Sorry, I was misinterpreting the API docs, difftotext is what I meant. Thanks!

Majr added a comment.Mar 31 2014, 8:02 AM

Since no one else has done this yet, I had a go at it and submitted the patch through the uploader.

Change 122327 had a related patch set uploaded (by Anomie):
Add pst option to API difftotext


Anomie moved this task from Unsorted to Needs Review on the MediaWiki-API board.Feb 19 2015, 6:59 PM

This would also be convenient for the live preview in MediaWiki (resources/src/mediawiki.action/mediawiki.action.edit.preview.js), where we currently need two API requests to display the diff (first to PST, second to actually diff).

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 15 2015, 8:02 PM
Majr claimed this task.Oct 17 2015, 4:14 AM

Rebased and updated patch to add release notes and get parser options in a better way.

A review before this gets outdated and needs rebasing again would be nice.

Majr updated the task description. (Show Details)Oct 17 2015, 4:16 AM
Majr set Security to None.

Change 122327 merged by jenkins-bot:
Add pst option to API difftotext

Anomie closed this task as Resolved.Oct 21 2015, 2:37 PM

Should go out to WMF wikis with 1.27.0-wmf.4, see for the schedule.