Page MenuHomePhabricator

Split special page alias resolution from SpecialPageFactory into a separate service
Closed, DeclinedPublic

Description

This was unearthed during https://gerrit.wikimedia.org/r/c/mediawiki/core/+/535657 for T232506: Inject services into special pages.

Proposed on IRC.

This will decouple the alias resolution from the special page factory, allowing the PermissionsManager to manage special page permissions independently of the SpecialPageFactory.

Original problem

From the change linked above:

[...] The move of the call to the SpecialPage_initList hook to the service construction is what caused the problem; MobileFrontend does some preference related stuff in a hook handler, which inadvertently calls the PreferencesFactory, which needs the PermissionsManager.

A MobileFrontend hook handler for SpecialPage_initList required the PermissionManager (indirectly I believe), which relies on the SpecialPageFactory, causing a circular dependency.

Event Timeline

Unfortunately, any alias resolver needs to know the list of special pages to know which special page belongs to which alias, which brings us back to the original issue, where extensions will (accidentally) need to specify special pages, but cannot do that without access to services that use the alias resolver.

This issue might be a valid concern, however, T259960 hasn't encountered it yet, therefore I'm going ahead and declining this.

The circumstances have also changed; Authority has been introduced as a concept, removing PermissionManager from some execution paths and changes in extending core special pages make the original issue less of a thing.