This new hook is called only once, for all overrides, instead of every time a message is fetched. Overrides can be specified as string or a callable, to allow for dynamically computing the override on-demand. These callables are passed the message key, MessageCache instance, the language and a boolean indicating if the message should be fetched from the database. The parameter choices are based upon current usages of the MessageCache::get hook. Bug: T328183 Change-Id: I89e1a9b901aff6ff1bde729df8958ba42a45f3d5
26 lines
843 B
PHP
26 lines
843 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Cache\Hook;
|
|
|
|
// phpcs:disable Squiz.Classes.ValidClassName.NotCamelCaps
|
|
/**
|
|
* This is a hook handler interface, see docs/Hooks.md.
|
|
* Use the hook name "MessageCache::get" to register handlers implementing this interface.
|
|
*
|
|
* @deprecated since 1.41 Use MessageCacheFetchOverrides instead
|
|
* @ingroup Hooks
|
|
*/
|
|
interface MessageCache__getHook {
|
|
/**
|
|
* This hook is called when fetching a message. Use this hook to override the key
|
|
* for customisations. Given and returned message key must be formatted with:
|
|
* 1) the first letter in lower case according to the content language
|
|
* 2) spaces replaced with underscores
|
|
*
|
|
* @since 1.35
|
|
*
|
|
* @param string &$key Message key
|
|
* @return bool|void True or no return value to continue or false to abort
|
|
*/
|
|
public function onMessageCache__get( &$key );
|
|
}
|