| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Hook; |
| 4 | |
| 5 | /** |
| 6 | * This is a hook handler interface, see docs/Hooks.md. |
| 7 | * Use the hook name "GetSecurityLogContext" to register handlers implementing this interface. |
| 8 | * |
| 9 | * @stable to implement |
| 10 | * @ingroup Hooks |
| 11 | */ |
| 12 | interface GetSecurityLogContextHook { |
| 13 | |
| 14 | /** |
| 15 | * This hook is called from WebRequest::getSecurityLogContext() to collect information about |
| 16 | * the request that's worth logging for log events which are relevant for security or |
| 17 | * anti-abuse purposes (login, credentials changes etc). |
| 18 | * |
| 19 | * @param array $info Information array with the following fields: |
| 20 | * - request: the WebRequest object |
| 21 | * - user: a UserIdentity object, or null. This is the user the log event is associated with |
| 22 | * (not necessarily the session user; not necessarily a locally existing user). The username |
| 23 | * is never an IP address. |
| 24 | * @param array &$context The PSR-3 log context. |
| 25 | * @return void This hook must not abort, it must return no value |
| 26 | * |
| 27 | * @since 1.45 (also backported to 1.43.9, 1.44.6) |
| 28 | * @see WebRequest::getSecurityLogContext() |
| 29 | */ |
| 30 | public function onGetSecurityLogContext( array $info, array &$context ): void; |
| 31 | |
| 32 | } |