Page MenuHomePhabricator

[ES-M5] Refactor `onLoadExtensionSchemaUpdates` hook handler to use hook interfaces and Dependency Injection
Closed, ResolvedPublic3 Estimated Story Points

Description

Currently, the registered onLoadExtensionSchemaUpdates hook handler is registered through a static method of the EntitySchemaHooks class. However, as this class depends on some MediaWiki services, it could leverage from the new MediaWiki dependency injection system.

To improve the analyzability and testability of this hook handler, we should refactor this static handler to a class that implements the LoadExtensionSchemaUpdatesHook interface and has its dependencies injected via constructor.

Acceptance Criteria:

  • The hook handler function is moved to a class that implements the LoadExtensionSchemaUpdatesHook interface and injects its dependent services
  • The hook handler's registration in extension.json declares its service dependencies for dependency injection

Event Timeline

ItamarWMDE renamed this task from [ES-M1] Refactor `onLoadExtensionSchemaUpdates` hook handler to use hook interfaces and Dependency Injection to [ES-M5] Refactor `onLoadExtensionSchemaUpdates` hook handler to use hook interfaces and Dependency Injection.May 18 2023, 9:14 AM
ItamarWMDE created this task.

Prio Notes

  • Impact Areas: Analyzability, Testability
  • Does not affect end users / production
  • Does not affect monitoring efforts
  • Does not affect development efforts
  • Affects onboarding efforts
  • Does not affect additional stakeholders

Change 949031 had a related patch set uploaded (by Noa wmde; author: Noa wmde):

[mediawiki/extensions/EntitySchema@master] Refactor LoadExtensionSchemaUpdates to use MW hook interface

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

Change 949031 merged by jenkins-bot:

[mediawiki/extensions/EntitySchema@master] Refactor LoadExtensionSchemaUpdates to use MW hook interface

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

Looks good to me, thank you!