Add Hook suffix to GetBlockErrorMessageKeyHook

Common naming convention for hook runner interfaces

The hook is new in 1.40 and the rename should be backported,
but the old name needs alias as it is already used in extensions.

Bug: T334689
Change-Id: I3f9e6d33f1bf29e937c82860fcebd088dde647da
This commit is contained in:
Umherirrender 2023-04-16 19:24:00 +02:00
parent ca662511da
commit 033e75cb26
4 changed files with 12 additions and 5 deletions

View file

@ -121,8 +121,8 @@ For notes on 1.39.x and older releases, see HISTORY.
* The ApiSandbox will now by default request responses in the latest API format, * The ApiSandbox will now by default request responses in the latest API format,
rather than the original format. Users can set `formatversion` to a different rather than the original format. Users can set `formatversion` to a different
value if needed. value if needed.
* A new hook, GetBlockErrorMessageKey, allows extensions' block error messages * A new hook, GetBlockErrorMessageKeyHook, allows extensions' block error
to be received and displayed by BlockErrorFormatter. messages to be received and displayed by BlockErrorFormatter.
* A new hook, SpecialCreateAccountBenefits, lets extensions and local code set * A new hook, SpecialCreateAccountBenefits, lets extensions and local code set
custom content on the signup page about the benefits of using an account. custom content on the signup page about the benefits of using an account.
* (T321412) A new 'PageUndeleteComplete' hook has been added for more thorough * (T321412) A new 'PageUndeleteComplete' hook has been added for more thorough

View file

@ -1187,7 +1187,8 @@ $wgAutoloadLocalClasses = [
'MediaWiki\\Hook\\FileUploadHook' => __DIR__ . '/includes/filerepo/Hook/FileUploadHook.php', 'MediaWiki\\Hook\\FileUploadHook' => __DIR__ . '/includes/filerepo/Hook/FileUploadHook.php',
'MediaWiki\\Hook\\FormatAutocommentsHook' => __DIR__ . '/includes/Hook/FormatAutocommentsHook.php', 'MediaWiki\\Hook\\FormatAutocommentsHook' => __DIR__ . '/includes/Hook/FormatAutocommentsHook.php',
'MediaWiki\\Hook\\GalleryGetModesHook' => __DIR__ . '/includes/gallery/Hook/GalleryGetModesHook.php', 'MediaWiki\\Hook\\GalleryGetModesHook' => __DIR__ . '/includes/gallery/Hook/GalleryGetModesHook.php',
'MediaWiki\\Hook\\GetBlockErrorMessageKey' => __DIR__ . '/includes/Hook/GetBlockErrorMessageKey.php', 'MediaWiki\\Hook\\GetBlockErrorMessageKey' => __DIR__ . '/includes/Hook/GetBlockErrorMessageKeyHook.php',
'MediaWiki\\Hook\\GetBlockErrorMessageKeyHook' => __DIR__ . '/includes/Hook/GetBlockErrorMessageKeyHook.php',
'MediaWiki\\Hook\\GetCacheVaryCookiesHook' => __DIR__ . '/includes/Hook/GetCacheVaryCookiesHook.php', 'MediaWiki\\Hook\\GetCacheVaryCookiesHook' => __DIR__ . '/includes/Hook/GetCacheVaryCookiesHook.php',
'MediaWiki\\Hook\\GetCanonicalURLHook' => __DIR__ . '/includes/Hook/GetCanonicalURLHook.php', 'MediaWiki\\Hook\\GetCanonicalURLHook' => __DIR__ . '/includes/Hook/GetCanonicalURLHook.php',
'MediaWiki\\Hook\\GetDefaultSortkeyHook' => __DIR__ . '/includes/Hook/GetDefaultSortkeyHook.php', 'MediaWiki\\Hook\\GetDefaultSortkeyHook' => __DIR__ . '/includes/Hook/GetDefaultSortkeyHook.php',

View file

@ -11,7 +11,7 @@ use MediaWiki\Block\Block;
* @stable to implement * @stable to implement
* @ingroup Hooks * @ingroup Hooks
*/ */
interface GetBlockErrorMessageKey { interface GetBlockErrorMessageKeyHook {
/** /**
* This hook is called in BlockErrorFormatter to allow * This hook is called in BlockErrorFormatter to allow
* extensions to override the message that will be displayed * extensions to override the message that will be displayed
@ -25,3 +25,9 @@ interface GetBlockErrorMessageKey {
*/ */
public function onGetBlockErrorMessageKey( Block $block, string &$key ); public function onGetBlockErrorMessageKey( Block $block, string &$key );
} }
/**
* Retain the old class name for backwards compatibility.
* @deprecated since 1.40
*/
class_alias( GetBlockErrorMessageKeyHook::class, 'MediaWiki\Hook\GetBlockErrorMessageKey' );

View file

@ -182,7 +182,7 @@ class HookRunner implements
\MediaWiki\Hook\FileUploadHook, \MediaWiki\Hook\FileUploadHook,
\MediaWiki\Hook\FormatAutocommentsHook, \MediaWiki\Hook\FormatAutocommentsHook,
\MediaWiki\Hook\GalleryGetModesHook, \MediaWiki\Hook\GalleryGetModesHook,
\MediaWiki\Hook\GetBlockErrorMessageKey, \MediaWiki\Hook\GetBlockErrorMessageKeyHook,
\MediaWiki\Hook\GetCacheVaryCookiesHook, \MediaWiki\Hook\GetCacheVaryCookiesHook,
\MediaWiki\Hook\GetCanonicalURLHook, \MediaWiki\Hook\GetCanonicalURLHook,
\MediaWiki\Hook\GetDefaultSortkeyHook, \MediaWiki\Hook\GetDefaultSortkeyHook,