Jump to content

Podręcznik:$wgSessionProviders

From mediawiki.org
This page is a translated version of the page Manual:$wgSessionProviders and the translation is 33% complete.
Identyfikacja: $wgSessionProviders
Session provider configuration.
Wprowadzono w wersji:1.27.0 (Gerrit change 243223; git #a73c5b73)
Usunięto w wersji:nadal w użyciu
Dozwolone wartości:(array of ObjectFactory specifications)
Domyślna wartość:zobacz niżej

Szczegóły

Specifies what providers to use for SessionManager . By default, CookieSessionProvider (for normal cookie-based authentication) and BotPasswordSessionProvider (for bot passwords) are included.

Order and array keys are not relevant. By convention, the array key is the classname of the provider.

Default values

Wersja MediaWiki:
1.40
$wgSessionProviders = [
	\MediaWiki\Session\CookieSessionProvider::class => [
		'class' => \MediaWiki\Session\CookieSessionProvider::class,
		'args' => [ [
			'priority' => 30,
		] ],
	],
	\MediaWiki\Session\BotPasswordSessionProvider::class => [
		'class' => \MediaWiki\Session\BotPasswordSessionProvider::class,
		'args' => [ [
			'priority' => 75,
		] ],
		'services' => [
			'GrantsInfo'
		],
	],
];
Wersja MediaWiki:
1.39
$wgSessionProviders = [
	\MediaWiki\Session\CookieSessionProvider::class => [
		'class' => \MediaWiki\Session\CookieSessionProvider::class,
		'args' => [ [
			'priority' => 30,
			'callUserSetCookiesHook' => true,
		] ],
	],
	\MediaWiki\Session\BotPasswordSessionProvider::class => [
		'class' => \MediaWiki\Session\BotPasswordSessionProvider::class,
		'args' => [ [
			'priority' => 75,
		] ],
		'services' => [
			'GrantsInfo'
		],
	],
];
Wersje MediaWiki:
1.27 – 1.38
$wgSessionProviders = [
	MediaWiki\Session\CookieSessionProvider::class => [
		'class' => MediaWiki\Session\CookieSessionProvider::class,
		'args' => [ [
			'priority' => 30,
			'callUserSetCookiesHook' => true,
		] ],
	],
	MediaWiki\Session\BotPasswordSessionProvider::class => [
		'class' => MediaWiki\Session\BotPasswordSessionProvider::class,
		'args' => [ [
			'priority' => 75,
		] ],
	],
];

Przykład

$wgSessionProviders[MyCustomSessionProvider::class] = [
    'class' => MyCustomSessionProvider::class,
    'args' => [ 'arg1', 'arg2' ],
];

or, if the extension uses extension registration (preferable):

{
    //...
    "SessionProviders": {
        "MyCustomSessionProvider": {
            "class": "MyCustomSessionProvider",
            "args": [ "arg1", "arg2" ]
    },
    //...
}

This will create a session provider object with new MyCustomSessionProvider( 'arg1', 'arg2' ), and register it as one of the session providers. See ObjectFactory for details of the object construction syntax.

Zobacz też