Page MenuHomePhabricator

Convert MWGrants to a service with dependency injection
Open, Needs TriagePublic

Description

Similar to how MWNamespace was replaced with a NamespaceInfo service, I propose that MWGrants be replaced with a GrantsInfo service.

The different static MWGrants methods use:

  • The LanguageFactory service
  • The LinkRenderer service
  • The ContentLanguage service (which is just the LanguageFactory with the LanguageCode config value)
  • wgGrantPermissions
  • wgGrantPermissionGroups

The services can be injected to the new GrantsInfo class, as well as a ServiceOptions object with the needed configuration values

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Pchelolo added a subscriber: Pchelolo.

Makes sense to me. The getGrantsLink and getGrantsWikiText are quite a bit more UI-related, so it would be interesting to think if we could put them elsewhere.

getGrantsWikiText is only used in OAuth extension special pages, so we could maybe just move this code in there, perhaps in a trait used in both special pages.

getGrantsLink is more tricky, but we can maybe find it a better home too. Not sure where yet.

Change 697673 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/core@master] [WIP] GrantsInfo service to replace MWGrants

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

Change 697673 merged by jenkins-bot:

[mediawiki/core@master] GrantsInfo service to replace MWGrants

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

Change 699300 had a related patch set uploaded (by Ebernhardson; author: Ebernhardson):

[mediawiki/core@master] Revert "GrantsInfo service to replace MWGrants"

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

Change 699300 merged by jenkins-bot:

[mediawiki/core@master] Revert "GrantsInfo service to replace MWGrants"

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

Change 710557 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/core@master] Reapply \"GrantsInfo service to replace MWGrants\"

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

Change 710557 abandoned by Zabe:

[mediawiki/core@master] Reapply \"GrantsInfo service to replace MWGrants\"

Reason:

going to reupload a new patch manually rebased and the issue addressed

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

Change 710608 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/core@master] Reapply \"GrantsInfo service to replace MWGrants\"

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

Change 710608 merged by jenkins-bot:

[mediawiki/core@master] Reapply \"GrantsInfo service to replace MWGrants\"

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

Change 722957 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/extensions/OAuth@master] Use GrantsInfo and GrantsLocalization instead of MWGrants

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

Change 697712 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/core@master] Use GrantsInfo and GrantsLocalization instead of MWGrants

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

Change 722957 merged by jenkins-bot:

[mediawiki/extensions/OAuth@master] Use GrantsInfo and GrantsLocalization instead of MWGrants

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

Change 779502 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/core@master] BotPasswordSessionProvider: inject GrantsInfo

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

Change 779502 merged by jenkins-bot:

[mediawiki/core@master] BotPasswordSessionProvider: inject GrantsInfo

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

Change 779571 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/extensions/TuleapWikiFarm@master] Use GrantsInfo instead of MWGrants

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

Change 779571 merged by Robert Vogel:

[mediawiki/extensions/TuleapWikiFarm@master] Use GrantsInfo instead of MWGrants

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

Change 697712 merged by jenkins-bot:

[mediawiki/core@master] Use GrantsInfo and GrantsLocalization instead of MWGrants

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

Change 812882 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/core@master] Hard deprecated the MWGrants class

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

Change 812882 merged by jenkins-bot:

[mediawiki/core@master] Hard deprecated the MWGrants class

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