Page MenuHomePhabricator

Create ActionFactory, add dependency injection to actions
Open, LowPublic

Description

The different action classes, retrieved from Action::factory, should instead be constructed from a dedicated factory service that has an object factory and provides each action the services it needs.

Actions used by services (I may have missed some):

ContentLanguage (HistoryAction, InfoAction, RevertAction)
HookContainer (FormAction, EditAction, HistoryAction, InfoAction, RawAction, ViewAction, WatchAction)
IContentHandlerFactory (RollbackAction)
ILoadBalancer (HistoryAction, InfoAction, both via wfGetDB)
LanguageNameUtils (InfoAction)
LinkBatchFactory (HistoryAction, InfoAction)
LinkRenderer (CreditsAction, HistoryAction, InfoAction, MarkpatrolledAction)
MagicWordFactory (InfoAction)
MainWANObjectCache (InfoAction)
NamespaceInfo (InfoAction)
PageProps (InfoAction, via PageProps::getInstance)
Parser (RawAction)
PermissionManager (HistoryAction, InfoAction, McrUndoAction, RawAction, WatchAction)
RepoGroup (InfoAction, RevertAction)
RevisionLookup (InfoAction, McrUndoAction, RawAction)
RevisionRenderer (McrUndoAction)
RevisionStore (HistoryAction, McrUndoAction)
SpecialPageFactory (SpecialPageAction)
UserFactory (CreditsAction, InfoAction, RawAction, all via User::newFromName)
UserOptionsLookup (RollbackAction, via User::getOption)
WatchedItemStore (InfoAction, WatchAction)
WatchlistNotificationManager (HistoryAction)
WikiPageFactory (WatchAction)

Don't exist yet, but:
RestrictionStore (InfoAction, RawAction)

SpecialPageFactory::getPage can be used as a model for the desired ActionFactory::getAction

Event Timeline

Restricted Application added a project: User-DannyS712. · View Herald TranscriptMay 18 2020, 11:09 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
DannyS712 moved this task from Unsorted to Later on the User-DannyS712 board.May 18 2020, 11:09 PM
DannyS712 updated the task description. (Show Details)May 20 2020, 8:36 PM
DannyS712 added a subscriber: eprodromou.EditedOct 21 2020, 3:03 PM

@eprodromou is it okay to move forward with this using ObjectFactory specs for DI? This has been in "Tech Planning Review" since May

DannyS712 updated the task description. (Show Details)Sun, Nov 22, 4:50 AM

@eprodromou is it okay to move forward with this using ObjectFactory specs for DI? This has been in "Tech Planning Review" since May

{{ping}}