Page MenuHomePhabricator

Turn ApiServiceFactory into proper service
Closed, ResolvedPublic

Description

The FederatedPropertiesServiceFactory (service name) / ApiServiceFactory (class name) was already moved to the service container in T279663, but it doesn’t behave like a proper service yet. Specifically:

  • Two of the services it creates are stored in static fields. Those static fields can be reset with its resetClassStatics(), which is called from WikibaseRepo’s own method of the same name. I’m pretty sure this is the reason of the test failures we’re seeing in T278011: Stop using the MediaWikiPHPUnitTest::startTest hook in Wikibase; the fields should be non-static, so that the lifetime of the services is automatically bound to the lifetime of the factory.
  • It gets several other services from global state rather than having them injected:
    • HttpRequestFactory
    • WikibaseRepo.DataTypeDefinitions
    • WikibaseRepo.ContentModelMappings

The first issue is the most important one to resolve, but the other one should hopefully not be too difficult either.

Event Timeline

Change 681363 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] Make ApiServiceFactory fields non-static

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

Change 681391 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/Wikibase@master] Inject services into ApiServiceFactory

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

Change 681363 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Make ApiServiceFactory fields non-static

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

Change 681391 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Inject services into ApiServiceFactory

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