Miscellaneous settings: $wgVirtualRestConfig
REST services configuration
Introduced in version:1.25.0 (Gerrit change 193826; git #b13bd099)
Removed in version:still in use
Allowed values:(array)
Default value: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

MediaWiki version:
1.28
$wgVirtualRestConfig = [
	'paths' => [],
	'modules' => [],
	'global' => [
		# <translate nowrap><!--T:15--> Timeout in seconds</translate>
		'timeout' => 360,
		# <translate nowrap><!--T:16--> <tvar|1>'domain'</> is set to <tvar|2>$wgCanonicalServer</> in <tvar|3>Setup.php</></translate>
		'forwardCookies' => false,
		'HTTPProxy' => null
	]
];
MediaWiki versions:
1.26 1.27
$wgVirtualRestConfig = [
	'modules' => [],
	'global' => [
		# Timeout in seconds
		'timeout' => 360,
		# 'domain' is set to $wgCanonicalServer in Setup.php
		'forwardCookies' => false,
		'HTTPProxy' => null
	]
];
MediaWiki version:
1.25
$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'] = [
	// <translate nowrap><!--T:17--> 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)</translate>
	'url' => 'http://localhost:8000/',
	// <translate nowrap><!--T:18--> Parsoid "domain" (string, optional)</translate> - MediaWiki >= 1.26
	'domain' => 'localhost',
	// <translate nowrap><!--T:19--> Parsoid "prefix" (string, optional)</translate> - <translate nowrap><!--T:20--> deprecated since MediaWiki 1.26, use '<tvar|domain>domain</>'</translate>
	'prefix' => 'localhost',
	// <translate nowrap><!--T:21--> Forward cookies in the case of private wikis (string or false, optional)</translate>
	'forwardCookies' => false,
	// <translate nowrap><!--T:22--> request timeout in seconds (integer or null, optional)</translate>
	'timeout' => null,
	// <translate nowrap><!--T:23--> Parsoid HTTP proxy (string or null, optional)</translate>
	'HTTPProxy' => null,
	// <translate nowrap><!--T:24--> whether to parse URL as if they were meant for RESTBase (boolean or null, optional)</translate>
	'restbaseCompat' => null,
];

RESTBase

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

$wgVirtualRestConfig['modules']['restbase'] = [
	// <translate nowrap><!--T:25--> RESTBase server URL (string)</translate>
	'url' => 'http://localhost:7231/',
	// <translate nowrap><!--T:26--> Wiki domain to use (string)</translate>
	'domain' => 'localhost',
	// <translate nowrap><!--T:27--> request timeout in seconds (integer or null, optional)</translate>
	'timeout' => 100,
	// <translate nowrap><!--T:28--> cookies to forward to RESTBase/Parsoid (string or false, optional)</translate>
	'forwardCookies' => false,
	// <translate nowrap><!--T:29--> HTTP proxy to use (string or null, optional)</translate>
	'HTTPProxy' => null,
	// <translate nowrap><!--T:30--> whether to parse URL as if they were meant for Parsoid (boolean, optional)</translate>
	'parsoidCompat' => false,
	// <translate nowrap><!--T:31--> whether to append the domain to the url</translate>
	'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

  • Parsoid
  • Extension:VisualEditor
  • RESTBase
This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.