| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Hook; |
| 4 | |
| 5 | use Article; |
| 6 | use MediaWiki\Request\WebRequest; |
| 7 | use MediaWiki\Title\Title; |
| 8 | |
| 9 | /** |
| 10 | * This is a hook handler interface, see docs/Hooks.md. |
| 11 | * Use the hook name "InitializeArticleMaybeRedirect" to register handlers implementing this interface. |
| 12 | * |
| 13 | * @stable to implement |
| 14 | * @ingroup Hooks |
| 15 | */ |
| 16 | interface InitializeArticleMaybeRedirectHook { |
| 17 | /** |
| 18 | * Use this hook to override whether a title is a redirect. |
| 19 | * |
| 20 | * @since 1.35 |
| 21 | * |
| 22 | * @param Title $title Title object for the current page |
| 23 | * @param WebRequest $request |
| 24 | * @param bool &$ignoreRedirect When set to true, the title will not redirect. |
| 25 | * @param Title|string &$target Set to an URL to do a HTTP redirect, or a Title to |
| 26 | * use that title instead of the original, without doing a HTTP redirect. |
| 27 | * @param Article &$article The Article object that belongs to $title. Passed as a reference |
| 28 | * for legacy reasons, but should not be changed. |
| 29 | * @return bool|void True or no return value to continue or false to abort |
| 30 | */ |
| 31 | public function onInitializeArticleMaybeRedirect( $title, $request, |
| 32 | &$ignoreRedirect, &$target, &$article |
| 33 | ); |
| 34 | } |