| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Output\Hook; |
| 4 | |
| 5 | use MediaWiki\Output\OutputPage; |
| 6 | |
| 7 | /** |
| 8 | * This is a hook handler interface, see docs/Hooks.md. |
| 9 | * Use the hook name "BeforePageRedirect" to register handlers implementing this interface. |
| 10 | * |
| 11 | * @stable to implement |
| 12 | * @ingroup Hooks |
| 13 | */ |
| 14 | interface BeforePageRedirectHook { |
| 15 | /** |
| 16 | * This hook is called prior to sending an HTTP redirect. Gives a chance to |
| 17 | * override how the redirect is output by modifying, or by returning false and |
| 18 | * taking over the output. |
| 19 | * |
| 20 | * @since 1.35 |
| 21 | * |
| 22 | * @param OutputPage $out |
| 23 | * @param string &$redirect Absolute or path-relative URL, modifiable |
| 24 | * @param string &$code HTTP code (eg '301' or '302'), modifiable |
| 25 | * @return bool|void True or no return value to continue or false to abort |
| 26 | */ |
| 27 | public function onBeforePageRedirect( $out, &$redirect, &$code ); |
| 28 | } |
| 29 | |
| 30 | /** @deprecated class alias since 1.42 */ |
| 31 | class_alias( BeforePageRedirectHook::class, 'MediaWiki\Hook\BeforePageRedirectHook' ); |