forked from wikimedia/mediawiki-extensions-EventBus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathServiceWiring.php
50 lines (45 loc) · 1.51 KB
/
ServiceWiring.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
use MediaWiki\Config\ServiceOptions;
use MediaWiki\Extension\EventBus\EventBusFactory;
use MediaWiki\Extension\EventBus\EventFactory;
use MediaWiki\Logger\LoggerFactory;
use MediaWiki\MediaWikiServices;
return [
'EventBus.EventBusFactory' => static function ( MediaWikiServices $services ): EventBusFactory {
if ( ExtensionRegistry::getInstance()->isLoaded( 'EventStreamConfig' ) ) {
// Mediawiki\Extension\EventStreamConfig\StreamConfigs instance.
$streamConfigs = $services->get( 'EventStreamConfig.StreamConfigs' );
} else {
// If null, EventBus will always use EventServiceDefault
// to produce all streams.
$streamConfigs = null;
}
return new EventBusFactory(
new ServiceOptions(
EventBusFactory::CONSTRUCTOR_OPTIONS,
$services->getMainConfig()
),
$streamConfigs,
$services->get( 'EventBus.EventFactory' ),
$services->getHttpRequestFactory()->createMultiClient(),
LoggerFactory::getInstance( 'EventBus' )
);
},
'EventBus.EventFactory' => static function ( MediaWikiServices $services ): EventFactory {
return new EventFactory(
new ServiceOptions(
EventFactory::CONSTRUCTOR_OPTIONS,
$services->getMainConfig()
),
$services->getMainConfig()->get( 'DBname' ),
$services->getContentLanguage(),
$services->getRevisionStore(),
$services->getTitleFormatter(),
$services->getUserGroupManager(),
$services->getUserEditTracker(),
$services->getWikiPageFactory(),
$services->getUserFactory(),
LoggerFactory::getInstance( 'EventBus' )
);
}
];