| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\SpecialPage\Hook; |
| 4 | |
| 5 | // phpcs:disable Squiz.Classes.ValidClassName.NotCamelCaps |
| 6 | /** |
| 7 | * This is a hook handler interface, see docs/Hooks.md. |
| 8 | * Use the hook name "SpecialPage_initList" to register handlers implementing this interface. |
| 9 | * |
| 10 | * @stable to implement |
| 11 | * @ingroup Hooks |
| 12 | */ |
| 13 | interface SpecialPage_initListHook { |
| 14 | /** |
| 15 | * This hook is called when setting up SpecialPageFactory::$list. Use |
| 16 | * this hook to remove a core special page or conditionally register special pages. |
| 17 | * |
| 18 | * @note The existence of a special page must not depend on the request context (e.g. current user or current |
| 19 | * title). Possible red/blue links from wiki pages are cached in the parser cache and must be stable across |
| 20 | * the requests from different users or for different pages. |
| 21 | * Use only site config or checks if extensions are loaded to add or remove special pages from the list. |
| 22 | * Override SpecialPage::userCanExecute or set a user right when calling SpecialPage::__construct, |
| 23 | * after registering the special page for all users, to restrict the access for users allowed to use the page. |
| 24 | * When replacing a (core) special page in the list, it is possible to depend on the request context, |
| 25 | * but this hook is also called from Setup and the user is not always safe to load, |
| 26 | * call User::isSafeToLoad before using any User class function or one of the user services like |
| 27 | * UserOptionsLookup/UserOptionsManager. |
| 28 | * Also the title may not be set for all requests (for e.g. api.php or load.php), |
| 29 | * so checks for title should be avoided. |
| 30 | * |
| 31 | * @since 1.35 |
| 32 | * |
| 33 | * @param array &$list List of core special pages, |
| 34 | * mapping of (canonical) page name to class name, factory callback or to ObjectFactory spec |
| 35 | * @return bool|void True or no return value to continue or false to abort |
| 36 | */ |
| 37 | public function onSpecialPage_initList( &$list ); |
| 38 | } |