Manual:Hooks/SessionCheckInfo
From Linux Web Expert
SessionCheckInfo | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 243223)</tvar></translate> Validate session info as it's being loaded from storage. | |
<translate> Define function:</translate> | public static function onSessionCheckInfo( &$reason, $info, $request, $metadata, $data ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"SessionCheckInfo": "MediaWiki\\Extension\\MyExtension\\Hooks::onSessionCheckInfo"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> session/SessionManager.php <translate> Function(s):</translate> loadSessionInfoFromStore |
<translate> Interface:</translate> | SessionCheckInfoHook.php |
<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:SessionCheckInfo extensions</tvar>.</translate>
Details
- &$reason: (string) rejection reason to be logged
- $info: SessionInfo being validated
- $request: WebRequest being loaded from
- $metadata: (array|false) metadata array for the Session
- $data: (array|false) data array for the Session
This hook is used to validate the current request against session metadata added by the SessionMetadata hook. To reject the session, set $reason
and return false.
A SessionProvider checking metadata for its own session does not need this hook; it should use its refreshSessionInfo()
method instead.