Page MenuHomePhabricator

Implement standard middleware interface in MediaWiki (PSR-15)
Open, Needs TriagePublic

Description

It would be really nice if we implemented PSR-15 which would allow standard middleware to be used within MediaWiki.

Use Cases

  • Using existing middlewares (examples) within MediaWiki
  • Add abstracted actions to the request/response pipeline (see T194396)
  • Abstract existing custom middlewares (like HTMLFileCache)

Event Timeline

What's the usecase here? Are we trying to reimplement fastcgi in PHP or something?

What's the usecase here? Are we trying to reimplement fastcgi in PHP or something?

  • Using existing middlewares (examples) within MediaWiki
  • Add abstracted actions to the request/response pipeline (see T194396)
  • Abstract existing custom middlewares (like HTMLFileCache)

It is quite likely that the pursuit of this task is mutually exclusive with T140664 and T106099.

From a quick glance, middleware-based services seems appropiate for web servers, not web applications. The main reason being that it opens up the ability to implement arbitrary new entry points in a way that isn't statically exportable in a stateless pure-data way, which may conflict with the desire to have a centralised registry that can be exported and used for knowing in advance what route and view template will respond to a particular user request.

There are an infinite number of specs and plugin models, but ultimately, we need to solve problems with solutions, and encourage consistency and re-use of solutions where possible. The easiest way to unblock this task would be to have a parent task that describes a particular product or developer need, for which this can be one of N possible solutions.

From a quick glance, middleware-based services seems appropiate for web servers, not web applications. The main reason being that it opens up the ability to implement arbitrary new entry points in a way that isn't statically exportable in a stateless pure-data way, which may conflict with the desire to have a centralised registry that can be exported and used for knowing in advance what route and view template will respond to a particular user request.

This is just within MediaWiki core, it wouldn't be outside of that (unless we exposed a hook to register middlewares, which I think we should).

There are an infinite number of specs and plugin models, but ultimately, we need to solve problems with solutions, and encourage consistency and re-use of solutions where possible.

I think implementing industry standards (where appropriate) is a step in that direction.

dbarratt renamed this task from Implement PSR-15 to Implement PSR-15 in MediaWiki.May 10 2018, 2:38 PM

It is quite likely that the pursuit of this task is mutually exclusive with T140664 and T106099.

From a quick glance, middleware-based services seems appropiate for web servers, not web applications. The main reason being that it opens up the ability to implement arbitrary new entry points in a way that isn't statically exportable in a stateless pure-data way, which may conflict with the desire to have a centralised registry that can be exported and used for knowing in advance what route and view template will respond to a particular user request.

A middleware could technically define a new endpoint, but that's not typically how they are used; more typically they handle cross-cutting concerns and fulfill a similar role to e.g. request filters in RESTBase.

Also, nothing stops middleware that do define new endpoints from exporting them.

Ankry renamed this task from i7caaaaaaa to Implement PSR-15 in MediaWiki.Jul 2 2018, 10:57 AM
Ankry raised the priority of this task from High to Needs Triage.
Ankry updated the task description. (Show Details)
Ankry added a subscriber: Aklapper.
Krinkle renamed this task from Implement PSR-15 in MediaWiki to Implement standard middleware interface in MediaWiki (PSR-15).Jul 28 2018, 8:45 PM

Change 879125 had a related patch set uploaded (by Gergő Tisza; author: Daniel Kinzler):

[mediawiki/core@master] REST: introduce a middleware mechanism

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

Change 971457 had a related patch set uploaded (by Daniel Kinzler; author: Daniel Kinzler):

[mediawiki/core@master] REST: introduce a middleware mechanism (chained)

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