2021-04-22 19:27:47 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ServiceWiring files for VisualEditor.
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @ingroup Extensions
|
|
|
|
* @copyright 2011-2021 VisualEditor Team and others; see AUTHORS.txt
|
|
|
|
* @license MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace MediaWiki\Extension\VisualEditor;
|
|
|
|
|
2022-08-29 10:44:06 +00:00
|
|
|
use MediaWiki\Config\ServiceOptions;
|
2022-09-04 09:00:14 +00:00
|
|
|
use MediaWiki\Logger\LoggerFactory;
|
2021-04-22 19:27:47 +00:00
|
|
|
use MediaWiki\MediaWikiServices;
|
|
|
|
|
|
|
|
return [
|
|
|
|
VisualEditorHookRunner::SERVICE_NAME => static function ( MediaWikiServices $services ): VisualEditorHookRunner {
|
|
|
|
return new VisualEditorHookRunner( $services->getHookContainer() );
|
|
|
|
},
|
2022-08-29 10:44:06 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
]
|
|
|
|
),
|
2022-09-04 09:00:14 +00:00
|
|
|
$services->getHttpRequestFactory(),
|
2022-08-28 19:25:04 +00:00
|
|
|
LoggerFactory::getInstance( 'VisualEditor' ),
|
2022-11-18 19:46:23 +00:00
|
|
|
$services->getPageRestHelperFactory()
|
2022-08-29 10:44:06 +00:00
|
|
|
);
|
|
|
|
},
|
2021-04-22 19:27:47 +00:00
|
|
|
];
|