Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 399 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
1 | <?php |
2 | /** |
3 | * List of services in this extension with construction instructions. |
4 | * |
5 | * @file |
6 | * @author Niklas Laxström |
7 | * @license GPL-2.0-or-later |
8 | */ |
9 | |
10 | use MediaWiki\Config\ServiceOptions; |
11 | use MediaWiki\Extension\Translate\Cache\PersistentCache; |
12 | use MediaWiki\Extension\Translate\Cache\PersistentDatabaseCache; |
13 | use MediaWiki\Extension\Translate\FileFormatSupport\FileFormatFactory; |
14 | use MediaWiki\Extension\Translate\HookRunner; |
15 | use MediaWiki\Extension\Translate\LogNames; |
16 | use MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleDependencyPurger; |
17 | use MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleMessageGroupFactory; |
18 | use MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleStore; |
19 | use MediaWiki\Extension\Translate\MessageBundleTranslation\MessageBundleTranslationLoader; |
20 | use MediaWiki\Extension\Translate\MessageGroupConfiguration\FileBasedMessageGroupFactory; |
21 | use MediaWiki\Extension\Translate\MessageGroupConfiguration\HookDefinedMessageGroupFactory; |
22 | use MediaWiki\Extension\Translate\MessageGroupConfiguration\MessageGroupConfigurationParser; |
23 | use MediaWiki\Extension\Translate\MessageGroupProcessing\AggregateGroupManager; |
24 | use MediaWiki\Extension\Translate\MessageGroupProcessing\AggregateGroupMessageGroupFactory; |
25 | use MediaWiki\Extension\Translate\MessageGroupProcessing\CsvTranslationImporter; |
26 | use MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupReviewStore; |
27 | use MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups; |
28 | use MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscription; |
29 | use MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscriptionHookHandler; |
30 | use MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroupSubscriptionStore; |
31 | use MediaWiki\Extension\Translate\MessageGroupProcessing\RevTagStore; |
32 | use MediaWiki\Extension\Translate\MessageGroupProcessing\SubpageListBuilder; |
33 | use MediaWiki\Extension\Translate\MessageGroupProcessing\TranslatableBundleExporter; |
34 | use MediaWiki\Extension\Translate\MessageGroupProcessing\TranslatableBundleFactory; |
35 | use MediaWiki\Extension\Translate\MessageGroupProcessing\TranslatableBundleImporter; |
36 | use MediaWiki\Extension\Translate\MessageGroupProcessing\TranslatableBundleStatusStore; |
37 | use MediaWiki\Extension\Translate\MessageGroupProcessing\TranslatablePageStore; |
38 | use MediaWiki\Extension\Translate\MessageLoading\CDBMessageIndex; |
39 | use MediaWiki\Extension\Translate\MessageLoading\DatabaseMessageIndex; |
40 | use MediaWiki\Extension\Translate\MessageLoading\HashMessageIndex; |
41 | use MediaWiki\Extension\Translate\MessageLoading\MessageIndex; |
42 | use MediaWiki\Extension\Translate\MessageLoading\MessageIndexStore; |
43 | use MediaWiki\Extension\Translate\MessageProcessing\MessageGroupMetadata; |
44 | use MediaWiki\Extension\Translate\PageTranslation\TranslatableBundleDeleter; |
45 | use MediaWiki\Extension\Translate\PageTranslation\TranslatableBundleMover; |
46 | use MediaWiki\Extension\Translate\PageTranslation\TranslatablePageMarker; |
47 | use MediaWiki\Extension\Translate\PageTranslation\TranslatablePageMessageGroupFactory; |
48 | use MediaWiki\Extension\Translate\PageTranslation\TranslatablePageParser; |
49 | use MediaWiki\Extension\Translate\PageTranslation\TranslatablePageStateStore; |
50 | use MediaWiki\Extension\Translate\PageTranslation\TranslatablePageView; |
51 | use MediaWiki\Extension\Translate\PageTranslation\TranslationUnitStoreFactory; |
52 | use MediaWiki\Extension\Translate\Statistics\MessageGroupStatsTableFactory; |
53 | use MediaWiki\Extension\Translate\Statistics\MessagePrefixStats; |
54 | use MediaWiki\Extension\Translate\Statistics\ProgressStatsTableFactory; |
55 | use MediaWiki\Extension\Translate\Statistics\TranslationStatsDataProvider; |
56 | use MediaWiki\Extension\Translate\Statistics\TranslatorActivity; |
57 | use MediaWiki\Extension\Translate\Statistics\TranslatorActivityQuery; |
58 | use MediaWiki\Extension\Translate\Synchronization\ExternalMessageSourceStateComparator; |
59 | use MediaWiki\Extension\Translate\Synchronization\ExternalMessageSourceStateImporter; |
60 | use MediaWiki\Extension\Translate\Synchronization\GroupSynchronizationCache; |
61 | use MediaWiki\Extension\Translate\TranslatorInterface\EntitySearch; |
62 | use MediaWiki\Extension\Translate\TranslatorSandbox\TranslateSandbox; |
63 | use MediaWiki\Extension\Translate\TranslatorSandbox\TranslationStashReader; |
64 | use MediaWiki\Extension\Translate\TranslatorSandbox\TranslationStashStorage; |
65 | use MediaWiki\Extension\Translate\TtmServer\TtmServerFactory; |
66 | use MediaWiki\Extension\Translate\Utilities\ConfigHelper; |
67 | use MediaWiki\Extension\Translate\Utilities\ParsingPlaceholderFactory; |
68 | use MediaWiki\Extension\Translate\Utilities\StringComparators\SimpleStringComparator; |
69 | use MediaWiki\Logger\LoggerFactory; |
70 | use MediaWiki\MediaWikiServices; |
71 | |
72 | /** @phpcs-require-sorted-array */ |
73 | return [ |
74 | 'Translate:AggregateGroupManager' => static function ( |
75 | MediaWikiServices $services |
76 | ): AggregateGroupManager { |
77 | return new AggregateGroupManager( |
78 | $services->getTitleFactory(), |
79 | $services->get( 'Translate:MessageGroupMetadata' ) |
80 | ); |
81 | }, |
82 | |
83 | 'Translate:AggregateGroupMessageGroupFactory' => static function ( |
84 | MediaWikiServices $services |
85 | ): AggregateGroupMessageGroupFactory { |
86 | return new AggregateGroupMessageGroupFactory( |
87 | $services->get( 'Translate:MessageGroupMetadata' ) |
88 | ); |
89 | }, |
90 | |
91 | 'Translate:ConfigHelper' => static function (): ConfigHelper { |
92 | return new ConfigHelper(); |
93 | }, |
94 | |
95 | 'Translate:CsvTranslationImporter' => static function ( MediaWikiServices $services ): CsvTranslationImporter { |
96 | return new CsvTranslationImporter( $services->getWikiPageFactory() ); |
97 | }, |
98 | |
99 | 'Translate:EntitySearch' => static function ( MediaWikiServices $services ): EntitySearch { |
100 | return new EntitySearch( |
101 | $services->getMainWANObjectCache(), |
102 | $services->getCollationFactory()->makeCollation( 'uca-default-u-kn' ), |
103 | MessageGroups::singleton(), |
104 | $services->getNamespaceInfo(), |
105 | $services->get( 'Translate:MessageIndex' ), |
106 | $services->getTitleParser(), |
107 | $services->getTitleFormatter() |
108 | ); |
109 | }, |
110 | |
111 | 'Translate:ExternalMessageSourceStateComparator' => static function ( |
112 | MediaWikiServices $services |
113 | ): ExternalMessageSourceStateComparator { |
114 | return new ExternalMessageSourceStateComparator( |
115 | new SimpleStringComparator(), |
116 | $services->getRevisionLookup(), |
117 | $services->getPageStore() |
118 | ); |
119 | }, |
120 | |
121 | 'Translate:ExternalMessageSourceStateImporter' => static function ( |
122 | MediaWikiServices $services |
123 | ): ExternalMessageSourceStateImporter { |
124 | return new ExternalMessageSourceStateImporter( |
125 | $services->get( 'Translate:GroupSynchronizationCache' ), |
126 | $services->getJobQueueGroup(), |
127 | LoggerFactory::getInstance( LogNames::GROUP_SYNCHRONIZATION ), |
128 | $services->get( 'Translate:MessageIndex' ), |
129 | $services->getTitleFactory(), |
130 | $services->get( 'Translate:MessageGroupSubscription' ), |
131 | new ServiceOptions( |
132 | ExternalMessageSourceStateImporter::CONSTRUCTOR_OPTIONS, |
133 | $services->getMainConfig() |
134 | ) |
135 | ); |
136 | }, |
137 | |
138 | 'Translate:FileBasedMessageGroupFactory' => static function ( |
139 | MediaWikiServices $services |
140 | ): FileBasedMessageGroupFactory { |
141 | return new FileBasedMessageGroupFactory( |
142 | new MessageGroupConfigurationParser(), |
143 | new ServiceOptions( |
144 | FileBasedMessageGroupFactory::SERVICE_OPTIONS, |
145 | $services->getMainConfig() |
146 | ), |
147 | ); |
148 | }, |
149 | |
150 | 'Translate:FileFormatFactory' => static function ( MediaWikiServices $services ): FileFormatFactory { |
151 | return new FileFormatFactory( $services->getObjectFactory() ); |
152 | }, |
153 | |
154 | 'Translate:GroupSynchronizationCache' => static function ( |
155 | MediaWikiServices $services |
156 | ): GroupSynchronizationCache { |
157 | return new GroupSynchronizationCache( $services->get( 'Translate:PersistentCache' ) ); |
158 | }, |
159 | |
160 | 'Translate:HookDefinedMessageGroupFactory' => static function ( |
161 | MediaWikiServices $services |
162 | ): HookDefinedMessageGroupFactory { |
163 | return new HookDefinedMessageGroupFactory( $services->get( 'Translate:HookRunner' ) ); |
164 | }, |
165 | |
166 | 'Translate:HookRunner' => static function ( |
167 | MediaWikiServices $services |
168 | ): HookRunner { |
169 | return new HookRunner( $services->getHookContainer() ); |
170 | }, |
171 | |
172 | 'Translate:MessageBundleDependencyPurger' => static function ( |
173 | MediaWikiServices $services |
174 | ): MessageBundleDependencyPurger { |
175 | return new MessageBundleDependencyPurger( $services->get( 'Translate:TranslatableBundleFactory' ) ); |
176 | }, |
177 | |
178 | 'Translate:MessageBundleMessageGroupFactory' => static function ( |
179 | MediaWikiServices $services |
180 | ): MessageBundleMessageGroupFactory { |
181 | return new MessageBundleMessageGroupFactory( |
182 | $services->get( 'Translate:MessageGroupMetadata' ), |
183 | new ServiceOptions( |
184 | MessageBundleMessageGroupFactory::SERVICE_OPTIONS, |
185 | $services->getMainConfig() |
186 | ), |
187 | ); |
188 | }, |
189 | |
190 | 'Translate:MessageBundleStore' => static function ( MediaWikiServices $services ): MessageBundleStore { |
191 | return new MessageBundleStore( |
192 | $services->get( 'Translate:RevTagStore' ), |
193 | $services->getJobQueueGroup(), |
194 | $services->getLanguageNameUtils(), |
195 | $services->get( 'Translate:MessageIndex' ), |
196 | $services->get( 'Translate:MessageGroupMetadata' ) |
197 | ); |
198 | }, |
199 | |
200 | 'Translate:MessageBundleTranslationLoader' => static function ( |
201 | MediaWikiServices $services |
202 | ): MessageBundleTranslationLoader { |
203 | return new MessageBundleTranslationLoader( $services->getLanguageFallback() ); |
204 | }, |
205 | |
206 | 'Translate:MessageGroupMetadata' => static function ( MediaWikiServices $services ): MessageGroupMetadata { |
207 | return new MessageGroupMetadata( $services->getConnectionProvider() ); |
208 | }, |
209 | |
210 | 'Translate:MessageGroupReviewStore' => static function ( MediaWikiServices $services ): MessageGroupReviewStore { |
211 | return new MessageGroupReviewStore( |
212 | $services->getConnectionProvider(), |
213 | $services->get( 'Translate:HookRunner' ) |
214 | ); |
215 | }, |
216 | |
217 | 'Translate:MessageGroupStatsTableFactory' => static function ( |
218 | MediaWikiServices $services |
219 | ): MessageGroupStatsTableFactory { |
220 | return new MessageGroupStatsTableFactory( |
221 | $services->get( 'Translate:ProgressStatsTableFactory' ), |
222 | $services->getLinkRenderer(), |
223 | $services->get( 'Translate:MessageGroupReviewStore' ), |
224 | $services->get( 'Translate:MessageGroupMetadata' ), |
225 | $services->getMainConfig()->get( 'TranslateWorkflowStates' ) !== false |
226 | ); |
227 | }, |
228 | |
229 | 'Translate:MessageGroupSubscription' => static function ( |
230 | MediaWikiServices $services |
231 | ): MessageGroupSubscription { |
232 | return new MessageGroupSubscription( |
233 | $services->get( 'Translate:MessageGroupSubscriptionStore' ), |
234 | $services->getJobQueueGroup(), |
235 | $services->getUserIdentityLookup(), |
236 | LoggerFactory::getInstance( LogNames::GROUP_SUBSCRIPTION ), |
237 | new ServiceOptions( |
238 | MessageGroupSubscription::CONSTRUCTOR_OPTIONS, |
239 | $services->getMainConfig() |
240 | ) |
241 | ); |
242 | }, |
243 | |
244 | 'Translate:MessageGroupSubscriptionHookHandler' => static function ( |
245 | MediaWikiServices $services |
246 | ): MessageGroupSubscriptionHookHandler { |
247 | return new MessageGroupSubscriptionHookHandler( |
248 | $services->get( 'Translate:MessageGroupSubscription' ), |
249 | $services->getUserFactory() |
250 | ); |
251 | }, |
252 | |
253 | 'Translate:MessageGroupSubscriptionStore' => static function ( |
254 | MediaWikiServices $services |
255 | ): MessageGroupSubscriptionStore { |
256 | return new MessageGroupSubscriptionStore( $services->getConnectionProvider() ); |
257 | }, |
258 | |
259 | 'Translate:MessageIndex' => static function ( MediaWikiServices $services ): MessageIndex { |
260 | $params = (array)$services->getMainConfig()->get( 'TranslateMessageIndex' ); |
261 | $class = array_shift( $params ); |
262 | |
263 | $implementationMap = [ |
264 | // Aliases for BC |
265 | 'HashMessageIndex' => HashMessageIndex::class, |
266 | 'CDBMessageIndex' => CDBMessageIndex::class, |
267 | 'DatabaseMessageIndex' => DatabaseMessageIndex::class, |
268 | // Recommended values |
269 | 'hash' => HashMessageIndex::class, |
270 | 'cdb' => CDBMessageIndex::class, |
271 | 'database' => DatabaseMessageIndex::class, |
272 | ]; |
273 | |
274 | /** @var MessageIndexStore $store */ |
275 | $messageIndexStoreClass = $implementationMap[$class] ?? $implementationMap['database']; |
276 | return new MessageIndex( |
277 | new $messageIndexStoreClass, |
278 | $services->getMainWANObjectCache(), |
279 | $services->getJobQueueGroup(), |
280 | $services->get( 'Translate:HookRunner' ), |
281 | LoggerFactory::getInstance( LogNames::MAIN ), |
282 | $services->getMainObjectStash(), |
283 | $services->getConnectionProvider(), |
284 | new ServiceOptions( MessageIndex::SERVICE_OPTIONS, $services->getMainConfig() ), |
285 | ); |
286 | }, |
287 | |
288 | 'Translate:MessagePrefixStats' => static function ( MediaWikiServices $services ): MessagePrefixStats { |
289 | return new MessagePrefixStats( $services->getTitleParser() ); |
290 | }, |
291 | |
292 | 'Translate:ParsingPlaceholderFactory' => static function (): ParsingPlaceholderFactory { |
293 | return new ParsingPlaceholderFactory(); |
294 | }, |
295 | |
296 | 'Translate:PersistentCache' => static function ( MediaWikiServices $services ): PersistentCache { |
297 | return new PersistentDatabaseCache( |
298 | $services->getConnectionProvider(), |
299 | $services->getJsonCodec() |
300 | ); |
301 | }, |
302 | |
303 | 'Translate:ProgressStatsTableFactory' => static function ( MediaWikiServices $services ): ProgressStatsTableFactory |
304 | { |
305 | return new ProgressStatsTableFactory( |
306 | $services->getLinkRenderer(), |
307 | $services->get( 'Translate:ConfigHelper' ), |
308 | $services->get( 'Translate:MessageGroupMetadata' ) |
309 | ); |
310 | }, |
311 | |
312 | 'Translate:RevTagStore' => static function ( MediaWikiServices $services ): RevTagStore { |
313 | return new RevTagStore( $services->getConnectionProvider() ); |
314 | }, |
315 | |
316 | 'Translate:SubpageListBuilder' => static function ( MediaWikiServices $services ): SubpageListBuilder |
317 | { |
318 | return new SubpageListBuilder( |
319 | $services->get( 'Translate:TranslatableBundleFactory' ), |
320 | $services->getLinkBatchFactory() |
321 | ); |
322 | }, |
323 | |
324 | 'Translate:TranslatableBundleDeleter' => static function ( MediaWikiServices $services ): TranslatableBundleDeleter |
325 | { |
326 | return new TranslatableBundleDeleter( |
327 | $services->getMainObjectStash(), |
328 | $services->getJobQueueGroup(), |
329 | $services->get( 'Translate:SubpageListBuilder' ), |
330 | $services->get( 'Translate:TranslatableBundleFactory' ) |
331 | ); |
332 | }, |
333 | |
334 | 'Translate:TranslatableBundleExporter' => static function ( |
335 | MediaWikiServices $services |
336 | ): TranslatableBundleExporter { |
337 | return new TranslatableBundleExporter( |
338 | $services->get( 'Translate:SubpageListBuilder' ), |
339 | $services->getWikiExporterFactory(), |
340 | $services->getConnectionProvider() |
341 | ); |
342 | }, |
343 | |
344 | 'Translate:TranslatableBundleFactory' => static function ( MediaWikiServices $services ): TranslatableBundleFactory |
345 | { |
346 | return new TranslatableBundleFactory( |
347 | $services->get( 'Translate:TranslatablePageStore' ), |
348 | $services->get( 'Translate:MessageBundleStore' ) |
349 | ); |
350 | }, |
351 | |
352 | 'Translate:TranslatableBundleImporter' => static function ( |
353 | MediaWikiServices $services |
354 | ): TranslatableBundleImporter { |
355 | return new TranslatableBundleImporter( |
356 | $services->getWikiImporterFactory(), |
357 | $services->get( 'Translate:TranslatablePageParser' ), |
358 | $services->getRevisionLookup(), |
359 | $services->getNamespaceInfo(), |
360 | $services->getTitleFactory(), |
361 | $services->getFormatterFactory() |
362 | ); |
363 | }, |
364 | |
365 | 'Translate:TranslatableBundleMover' => static function ( MediaWikiServices $services ): TranslatableBundleMover |
366 | { |
367 | return new TranslatableBundleMover( |
368 | $services->getMovePageFactory(), |
369 | $services->getJobQueueGroup(), |
370 | $services->getLinkBatchFactory(), |
371 | $services->get( 'Translate:TranslatableBundleFactory' ), |
372 | $services->get( 'Translate:SubpageListBuilder' ), |
373 | $services->getConnectionProvider(), |
374 | $services->getObjectCacheFactory(), |
375 | $services->getMainConfig()->get( 'TranslatePageMoveLimit' ) |
376 | ); |
377 | }, |
378 | |
379 | 'Translate:TranslatableBundleStatusStore' => |
380 | static function ( MediaWikiServices $services ): TranslatableBundleStatusStore { |
381 | return new TranslatableBundleStatusStore( |
382 | $services->getConnectionProvider()->getPrimaryDatabase(), |
383 | $services->getCollationFactory()->makeCollation( 'uca-default-u-kn' ), |
384 | $services->getDBLoadBalancer()->getMaintenanceConnectionRef( DB_PRIMARY ) |
385 | ); |
386 | }, |
387 | |
388 | 'Translate:TranslatablePageMarker' => static function ( MediaWikiServices $services ): TranslatablePageMarker { |
389 | return new TranslatablePageMarker( |
390 | $services->getConnectionProvider(), |
391 | $services->getJobQueueGroup(), |
392 | $services->getLinkRenderer(), |
393 | MessageGroups::singleton(), |
394 | $services->get( 'Translate:MessageIndex' ), |
395 | $services->getTitleFormatter(), |
396 | $services->getTitleParser(), |
397 | $services->get( 'Translate:TranslatablePageParser' ), |
398 | $services->get( 'Translate:TranslatablePageStore' ), |
399 | $services->get( 'Translate:TranslatablePageStateStore' ), |
400 | $services->get( 'Translate:TranslationUnitStoreFactory' ), |
401 | $services->get( 'Translate:MessageGroupMetadata' ), |
402 | $services->getWikiPageFactory(), |
403 | $services->get( 'Translate:TranslatablePageView' ), |
404 | $services->get( 'Translate:MessageGroupSubscription' ), |
405 | $services->getFormatterFactory() |
406 | ); |
407 | }, |
408 | |
409 | 'Translate:TranslatablePageMessageGroupFactory' => static function ( |
410 | MediaWikiServices $services |
411 | ): TranslatablePageMessageGroupFactory { |
412 | return new TranslatablePageMessageGroupFactory( |
413 | new ServiceOptions( |
414 | TranslatablePageMessageGroupFactory::SERVICE_OPTIONS, |
415 | $services->getMainConfig() |
416 | ), |
417 | ); |
418 | }, |
419 | |
420 | 'Translate:TranslatablePageParser' => static function ( MediaWikiServices $services ): TranslatablePageParser |
421 | { |
422 | return new TranslatablePageParser( |
423 | $services->get( 'Translate:ParsingPlaceholderFactory' ) |
424 | ); |
425 | }, |
426 | |
427 | 'Translate:TranslatablePageStateStore' => static function ( |
428 | MediaWikiServices $services |
429 | ): TranslatablePageStateStore { |
430 | return new TranslatablePageStateStore( |
431 | $services->get( 'Translate:PersistentCache' ), |
432 | $services->getPageStore() |
433 | ); |
434 | }, |
435 | |
436 | 'Translate:TranslatablePageStore' => static function ( MediaWikiServices $services ): TranslatablePageStore |
437 | { |
438 | return new TranslatablePageStore( |
439 | $services->get( 'Translate:MessageIndex' ), |
440 | $services->getJobQueueGroup(), |
441 | $services->get( 'Translate:RevTagStore' ), |
442 | $services->getConnectionProvider(), |
443 | $services->get( 'Translate:TranslatableBundleStatusStore' ), |
444 | $services->get( 'Translate:TranslatablePageParser' ), |
445 | $services->get( 'Translate:MessageGroupMetadata' ) |
446 | ); |
447 | }, |
448 | |
449 | 'Translate:TranslatablePageView' => static function ( MediaWikiServices $services ): TranslatablePageView { |
450 | return new TranslatablePageView( |
451 | $services->getConnectionProvider(), |
452 | $services->get( 'Translate:TranslatablePageStateStore' ), |
453 | new ServiceOptions( |
454 | TranslatablePageView::SERVICE_OPTIONS, |
455 | $services->getMainConfig() |
456 | ) |
457 | ); |
458 | }, |
459 | |
460 | 'Translate:TranslateSandbox' => static function ( MediaWikiServices $services ): TranslateSandbox |
461 | { |
462 | return new TranslateSandbox( |
463 | $services->getUserFactory(), |
464 | $services->getConnectionProvider(), |
465 | $services->getPermissionManager(), |
466 | $services->getAuthManager(), |
467 | $services->getUserGroupManager(), |
468 | $services->getActorStore(), |
469 | $services->getUserOptionsManager(), |
470 | $services->getJobQueueGroup(), |
471 | $services->get( 'Translate:HookRunner' ), |
472 | new ServiceOptions( |
473 | TranslateSandbox::CONSTRUCTOR_OPTIONS, |
474 | $services->getMainConfig() |
475 | ) |
476 | ); |
477 | }, |
478 | |
479 | 'Translate:TranslationStashReader' => static function ( MediaWikiServices $services ): TranslationStashReader |
480 | { |
481 | return new TranslationStashStorage( $services->getConnectionProvider()->getPrimaryDatabase() ); |
482 | }, |
483 | |
484 | 'Translate:TranslationStatsDataProvider' => static function ( |
485 | MediaWikiServices $services |
486 | ): TranslationStatsDataProvider { |
487 | return new TranslationStatsDataProvider( |
488 | new ServiceOptions( |
489 | TranslationStatsDataProvider::CONSTRUCTOR_OPTIONS, |
490 | $services->getMainConfig() |
491 | ), |
492 | $services->getObjectFactory(), |
493 | $services->getConnectionProvider() |
494 | ); |
495 | }, |
496 | |
497 | 'Translate:TranslationUnitStoreFactory' => static function ( |
498 | MediaWikiServices $services |
499 | ): TranslationUnitStoreFactory { |
500 | return new TranslationUnitStoreFactory( $services->getDBLoadBalancer() ); |
501 | }, |
502 | |
503 | 'Translate:TranslatorActivity' => static function ( MediaWikiServices $services ): TranslatorActivity { |
504 | $query = new TranslatorActivityQuery( |
505 | $services->getMainConfig(), |
506 | $services->getDBLoadBalancer() |
507 | ); |
508 | |
509 | return new TranslatorActivity( |
510 | $services->getMainObjectStash(), |
511 | $query, |
512 | $services->getJobQueueGroup() |
513 | ); |
514 | }, |
515 | |
516 | 'Translate:TtmServerFactory' => static function ( MediaWikiServices $services ): TtmServerFactory { |
517 | $config = $services->getMainConfig(); |
518 | |
519 | $default = $config->get( 'TranslateTranslationDefaultService' ); |
520 | if ( $default === false ) { |
521 | $default = null; |
522 | } |
523 | |
524 | return new TtmServerFactory( $config->get( 'TranslateTranslationServices' ), $default ); |
525 | } |
526 | ]; |