Showcase how the separation of concerns should work between MediaWiki API and web
Open, Needs TriagePublic

Description

MediaWiki API modules and special pages contain lots of business logic, often duplicated between the two in similar-but-not-quite-identical ways. The business logic in these pages also tends to be inaccessible internally (so MediaWiki code that wants to access the functionality does horrible things like instantiating a SpecialPage object or making FauxRequest calls to the API). Everyone agrees the current situation sucks; no one seems to be sure how exactly the right way would look like, so newly written code does not necessarily end up in better shape.

We should pick some special pages and API modules (probably two of each since the answer will look very differently for something that does paged queries and for everything else), refactor them and turn them into a showcase that can be used as a guidance for future work.

Tgr created this task.Jan 31 2017, 11:15 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 31 2017, 11:15 PM
Anomie added a subscriber: Anomie.Feb 1 2017, 1:13 AM

ApiRevisionDelete, ApiManageTags, ApiTag, and ApiProtect seem like decent examples of separating out the business logic.

As for query modules in core, ApiQueryDuplicateFiles, ApiQueryPageProps, ApiQueryPrefixSearch, and ApiQuerySearch seem like the best examples at the moment. ApiQueryWatchlist is another example that was intentionally attempted to be done in the right style, although Special:Watchlist hasn't been converted yet. ApiQueryBase doesn't encourage a good style here, and Pager seems to be a bit too web-UI focused.

Osnard awarded a token.Feb 1 2017, 6:50 AM

This proposal is selected for the Developer-Wishlist voting round and will be added to a MediaWiki page very soon. To the subscribers, or proposer of this task: please help modify the task description: add a brief summary (10-12 lines) of the problem that this proposal raises, topics discussed in the comments, and a proposed solution (if there is any yet). Remember to add a header with a title "Description," to your content. Please do so before February 5th, 12:00 pm UTC.