Page MenuHomePhabricator

Spec a PHP interface that will serve as an entry point into the Parsoid-PHP composer lib
Closed, ResolvedPublic

Description

Quoting @ssastry from IRC,

we need to spec a PHP interface that will serve as an entry point into the Parsoid-PHP composer lib. integration and api code in mediawiki core will be written against this interface. loosely, the implementation of this interface will be what you've already done with lib/parse.js and lib/FromHTML.js ... but will probably look a little different.

@cscott adds,

probably review the phab task for dependency injection. the constructor or entry point should probably take an abstract object for Env, I think that's the point at which all our "dependencies are injected"

Event Timeline

probably review the phab task for dependency injection. the constructor or entry point should probably take an abstract object for Env, I think that's the point at which all our "dependencies are injected"

I don't think we want to inject an Env. The plan I had was that we'd inject a SiteConfig into the constructor, and pass a PageConfig and DataAccess into the entry point methods as it's possible for MediaWiki to want to parse multiple different blobs of wikitext within the course of one request (and ideally without having to reinitialize Parsoid each time). The entry point methods would combine the three to create the Env, which would be completely internal to Parsoid-PHP.

ssastry triaged this task as High priority.May 1 2019, 2:31 AM

probably review the phab task for dependency injection. the constructor or entry point should probably take an abstract object for Env, I think that's the point at which all our "dependencies are injected"

I don't think we want to inject an Env. The plan I had was that we'd inject a SiteConfig into the constructor, and pass a PageConfig and DataAccess into the entry point methods as it's possible for MediaWiki to want to parse multiple different blobs of wikitext within the course of one request (and ideally without having to reinitialize Parsoid each time). The entry point methods would combine the three to create the Env, which would be completely internal to Parsoid-PHP.

This is my understanding as well. Env is an entirely Parsoid-PHP internal wrapper. Core doesn't need to know about Env and only deals with the SiteConfig, PageConfig, and DataAccess interfaces.

Change 509531 had a related patch set uploaded (by Arlolra; owner: Arlolra):
[mediawiki/services/parsoid@master] [WIP] Entrypoint into the library

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

Change 509531 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Stub out entrypoint into the library

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

Change 509531 merged by jenkins-bot:

Well, that's a start.