Page MenuHomePhabricator

Document canonical hook name in hook interfaces
Closed, ResolvedPublic

Description

Background: Some hook names changed when moving from the old to the new hook system. This is because php does not support colon characters in interface names, therefore the colons were replaced with underscores. This can cause a confusing situation, where as an extension developer I wouldn't know what name to use to register the hook.

The canonical name of the hook should be documented in the hook interface, so it becomes discoverable.

Originally, this task asked for the canonical name of the hook to be a constant (NAME) in the hook interface. However, that causes a conflict when a class implements more than one hook interface. Implementing multiple hook interfaces in a single class is explicitly supported and desirable, so a NAME constant can't work.

Event Timeline

Change 626517 had a related patch set uploaded (by Tim Starling; owner: Tim Starling):
[mediawiki/core@master] Add NAME constant to all hook interfaces

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

Change 626517 abandoned by Tim Starling:
[mediawiki/core@master] Add NAME constant to all hook interfaces

Reason:

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

Change 630336 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/core@master] Document hook names in hook interfaces.

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

daniel renamed this task from Add NAME constant to hook interfaces to Document canonical hook name in hook interfaces.Sep 26 2020, 1:23 PM
daniel updated the task description. (Show Details)

Change 630336 merged by jenkins-bot:
[mediawiki/core@master] Document hook names in hook interfaces.

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