| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Cache\Hook; |
| 4 | |
| 5 | /** |
| 6 | * This is a hook handler interface, see docs/Hooks.md. |
| 7 | * Use the hook name "MessageCacheFetchOverrides" to register handlers implementing this interface. |
| 8 | * |
| 9 | * @stable to implement |
| 10 | * @ingroup Hooks |
| 11 | */ |
| 12 | interface MessageCacheFetchOverridesHook { |
| 13 | /** |
| 14 | * This hook is called to fetch overrides. Use this hook to override message keys |
| 15 | * for customisations. Returned messages key must be formatted with: |
| 16 | * 1) the first letter in lower case according to the content language |
| 17 | * 2) spaces replaced with underscores |
| 18 | * |
| 19 | * @since 1.41 |
| 20 | * |
| 21 | * @param (string|callable)[] &$keys Message keys mapped to their override. Values may also be a |
| 22 | * callable that returns a message key. Callables are passed the message key, |
| 23 | * the MessageCache instance, a Language/StubUserLang object and a boolean indicating if the |
| 24 | * value should be fetched from the database. Note that strings will always be interpreted as |
| 25 | * a message key; this is not valid callable syntax! This prevents ambiguity between message keys and functions. |
| 26 | * Use Closure::fromCallable or another valid callable syntax. |
| 27 | */ |
| 28 | public function onMessageCacheFetchOverrides( array &$keys ): void; |
| 29 | } |