Page MenuHomePhabricator

Add a factory service for `RecentChange` objects
Open, LowPublic

Description

I propose creating a factory for RecentChanges that would inject the needed dependencies:

  • LoadBalancer (currently uses wfGetDB)
  • CommentStore (currently uses CommentStore::getStore())
  • ActorMigration (currently uses ActorMigration::newMigration())
  • HookContainer (currently uses Hooks::run())
  • PermissionManager
  • Global variables $wgPutIPinRC, $wgUseEnotif, $wgShowUpdatedMarker, $wgRCFeeds, $wgRCEngines, $wgUseRCPatrol, $wgUseNPPatrol, $wgUseFilePatrol, $wgLogRestrictions, $wgRCMaxAge

Event Timeline

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

I believe that RC has to be converted to a value object, and all the DB-related stuff has to be moved into a new RecentChangeStore. Factory can be an interface implemented by the store, just like RevisionFactory and RevisionStore.

Perhaps the RC class after extracting DB functionality wouldn't be as pure as we'd want, since I see the, for example, 'getAttribute' loads comment from he comment store, but that could be implemented via some callbacks.

Some methods In RC, like 'doMarkPatrolled' probably doesn't belong in the store at all and should be moved elsewhere.