Page MenuHomePhabricator

Use PHP Virtual REST Service to access Parsoid
Closed, ResolvedPublic8 Estimated Story Points

Description

Write a Parsoid backend for VirtualRestService, and replace VisualEditor's and Flow's hacks with that. Incorporate the cookie forwarding hacks from VE as well.

See https://www.mediawiki.org/wiki/Requests_for_comment/PHP_Virtual_REST_Service and https://github.com/wikimedia/mediawiki/tree/master/includes/libs/virtualrest

This would also be a good opportunity to clean up the way the Parsoid URL (and whether it's available) is configured in mediawiki-config

See also: T74988

Related Objects

StatusSubtypeAssignedTask
OpenReleaseNone
OpenNone
ResolvedKrenair
Resolved GWicke
Resolved GWicke
Resolved GWicke
Resolvedfgiunchedi
Resolvedfgiunchedi
Resolved Cmjohnson
Resolved Cmjohnson
ResolvedJoe
Resolvedfgiunchedi
Resolved GWicke
Resolved Jdouglas
Resolved GWicke
Resolved GWicke
ResolvedArlolra
Resolved GWicke
Resolved mobrovac
Resolved mobrovac
Resolved mobrovac
Resolved mobrovac
Duplicate Jdouglas
ResolvedAndrew
Resolved GWicke
Resolvedfgiunchedi
Resolvedfgiunchedi
Resolvedfgiunchedi
ResolvedEevans
Resolvedfgiunchedi
Resolved GWicke
Resolved GWicke
Resolvedfgiunchedi
Resolved mobrovac
Resolved GWicke

Event Timeline

bd808 raised the priority of this task from to Medium.
bd808 updated the task description. (Show Details)
bd808 added a project: Scrum-of-Scrums.
bd808 changed Security from none to None.
Catrope renamed this task from use PHP Virtual REST Service to access Parsoid on private wikis (e.g. officewiki) to Use PHP Virtual REST Service to access Parsoid.Dec 16 2014, 8:25 PM
Catrope updated the task description. (Show Details)
Jdforrester-WMF raised the priority of this task from Medium to High.Dec 16 2014, 8:27 PM

It might be nice to model the internal interface somewhat similar to the way the RESTBase interface will look like:

  • GET /v1/local/page/Foo/html/123456 -- HTML for page Foo at revision 123456
  • GET /v1/local/page/Foo/data-mw/123456 -- data-mw for same
  • POST /v1/local/convert/html/to/wikitext -- convert html to wikitext, body tbd

The local bit here could be shorthand for the local domain / wiki. Page titles are percent-encoded, so slashes are no problem.

The cookie authentication business should be doable in the virtualrest backend handler for the parsoid end point, so that users don't need to deal with it. The backend is also the only place that needs to deal with actual host names etc from the config.

I ran into issues with the way I was trying to use VirtualRESTService. My onResponses function was not getting called. Aaron said "seems like there should be a $execReqsByService for the second loop to over so onReponse is called for non-replaced requests too" (referring to code in VirtualRESTServiceClient::runMulti)

Change 181011 had a related patch set uploaded (by Alex Monk):
Make a VirtualRESTService class for Parsoid, and use it

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

Patch-For-Review

I ran into issues with the way I was trying to use VirtualRESTService. My onResponses function was not getting called. Aaron said "seems like there should be a $execReqsByService for the second loop to over so onReponse is called for non-replaced requests too" (referring to code in VirtualRESTServiceClient::runMulti)

We fixed the issue I was running into in https://gerrit.wikimedia.org/r/181121, @aaron made https://gerrit.wikimedia.org/r/181119 to fix the issue we found last night.

Krenair moved this task from Bug Fixes to Blocked on the VisualEditor board.

Change 181706 had a related patch set uploaded (by Alex Monk):
Make a VirtualRESTService class for Parsoid

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

Patch-For-Review

Change 181706 merged by jenkins-bot:
Make a VirtualRESTService class for Parsoid

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

Change 181011 merged by jenkins-bot:
Use ParsoidVirtualRESTService

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