mediawiki-extensions-Visual.../includes/ServiceWiring.php
daniel 0cd6c90d5a Extract RESTbase client code into VRSParsoidClient.
This makes the "direct" client and the VRS based client
implement the same interface, so the caller doesn't have to know
which one it is using.

It looks like ParsoidHelper will not be needed if we use this approach.

Change-Id: Ib1c1d7355951fc0765227dd01a9edfc554fc448d
2022-09-14 18:20:36 +01:00

45 lines
1.2 KiB
PHP

<?php
/**
* ServiceWiring files for VisualEditor.
*
* @file
* @ingroup Extensions
* @copyright 2011-2021 VisualEditor Team and others; see AUTHORS.txt
* @license MIT
*/
namespace MediaWiki\Extension\VisualEditor;
use MediaWiki\Config\ServiceOptions;
use MediaWiki\Logger\LoggerFactory;
use MediaWiki\MediaWikiServices;
return [
VisualEditorHookRunner::SERVICE_NAME => static function ( MediaWikiServices $services ): VisualEditorHookRunner {
return new VisualEditorHookRunner( $services->getHookContainer() );
},
VisualEditorParsoidClientFactory::SERVICE_NAME => static function (
MediaWikiServices $services
): VisualEditorParsoidClientFactory {
$isPrivateWiki = !$services->getPermissionManager()->isEveryoneAllowed( 'read' );
return new VisualEditorParsoidClientFactory(
new ServiceOptions(
VisualEditorParsoidClientFactory::CONSTRUCTOR_OPTIONS,
$services->getMainConfig(),
[
VisualEditorParsoidClientFactory::ENABLE_COOKIE_FORWARDING => $isPrivateWiki
]
),
$services->getParsoidSiteConfig(),
$services->getParsoidPageConfigFactory(),
$services->getParsoidDataAccess(),
$services->getGlobalIdGenerator(),
$services->getHttpRequestFactory(),
LoggerFactory::getInstance( 'VisualEditor' )
);
},
];