Manual:$wgVirtualRestConfig/de-formal

From Linux Web Expert

<translate> Miscellaneous settings</translate>: $wgVirtualRestConfig
REST services configuration
<translate> Introduced in version:</translate>1.25.0 (Gerrit change 193826; git #b13bd099)
<translate> Removed in version:</translate><translate> still in use</translate>
<translate> Allowed values:</translate>(array)
<translate> Default value:</translate>See below

Details

Register REST services in the subarray modules, and change the default values in the subarray global.

The main example is Parsoid, which should be configured using this parameter since MediaWiki 1.25 (see also Extension:VisualEditor ). When upgrading from MediaWiki 1.25 to 1.26, the 'prefix' value must be renamed 'domain' (the latter can be added with the same value as the former for a smooth transition).

RESTBase can also be registered in this parameter.

Default value

<td class="mw-version-versionbox" title="<translate nowrap> The latest stable version is <tvar name=1>1.41</tvar></translate>">
<translate> ≥</translate> 1.28
<translate> MediaWiki version:</translate>
$wgVirtualRestConfig = [
	'paths' => [],
	'modules' => [],
	'global' => [
		# Timeout in seconds
		'timeout' => 360,
		# 'domain' is set to $wgCanonicalServer in Setup.php
		'forwardCookies' => false,
		'HTTPProxy' => null
	]
];
<td class="mw-version-versionbox" title="<translate nowrap> MediaWiki <tvar name=1>1.27</tvar> is unsupported version</translate>">
1.26 – 1.27
<translate> MediaWiki versions:</translate>
$wgVirtualRestConfig = [
	'modules' => [],
	'global' => [
		# Timeout in seconds
		'timeout' => 360,
		# 'domain' is set to $wgCanonicalServer in Setup.php
		'forwardCookies' => false,
		'HTTPProxy' => null
	]
];
<td class="mw-version-versionbox" title="<translate nowrap> MediaWiki <tvar name=1>1.25</tvar> is unsupported version</translate>">
1.25
MediaWiki Version:
$wgVirtualRestConfig = array(
	'modules' => array(),
	'global' => array(
		# Timeout in seconds
		'timeout' => 360,
		'forwardCookies' => false,
		'HTTPProxy' => null
	)
);

Parsoid

These are the default values when Parsoid is registered as a REST service, used when some keys are not defined.

$wgVirtualRestConfig['modules']['parsoid'] = [
	// URL to the Parsoid instance - use port 8142 if you use the Debian package - the parameter 'URL' was first used but is now deprecated (string)
	'url' => 'http://localhost:8000/',
	// Parsoid "domain" (string, optional) - MediaWiki >= 1.26
	'domain' => 'localhost',
	// Parsoid "prefix" (string, optional) - deprecated since MediaWiki 1.26, use 'domain'
	'prefix' => 'localhost',
	// Forward cookies in the case of private wikis (string or false, optional)
	'forwardCookies' => false,
	// request timeout in seconds (integer or null, optional)
	'timeout' => null,
	// Parsoid HTTP proxy (string or null, optional)
	'HTTPProxy' => null,
	// whether to parse URL as if they were meant for RESTBase (boolean or null, optional)
	'restbaseCompat' => null,
];

RESTBase

These are the default values when a RESTBase service is registered, used when some keys are not defined.

$wgVirtualRestConfig['modules']['restbase'] = [
	// RESTBase server URL (string)
	'url' => 'http://localhost:7231/',
	// Wiki domain to use (string)
	'domain' => 'localhost',
	// request timeout in seconds (integer or null, optional)
	'timeout' => 100,
	// cookies to forward to RESTBase/Parsoid (string or false, optional)
	'forwardCookies' => false,
	// HTTP proxy to use (string or null, optional)
	'HTTPProxy' => null,
	// whether to parse URL as if they were meant for Parsoid (boolean, optional)
	'parsoidCompat' => false,
	// whether to append the domain to the url
	'fixedUrl' => false,
];

Proxying

To use a remote RESTBase installation (e.g. for testing an extension without having to install the service), you can use a setting like this:

foreach ( $wgVirtualRestConfig['modules'] as &$module ) {
        $module['url'] = 'https://en.wikipedia.org/api/rest_v1/';
        $module['forwardCookies'] = false;
}
$wgVirtualRestConfig['modules']['restbase']['fixedUrl'] = true;

See also