39 private int $initialTimeoutSeconds;
40 private int $incrementalTimeoutSeconds;
42 private const GROUP_LIST_TAG =
'gsc_%group_in_sync%';
44 private const GROUP_ERROR_TAG =
'gsc_%group_with_error%';
46 private const GROUP_IN_REVIEW_TAG =
'gsc_%group_in_review%';
47 private LoggerInterface $logger;
49 public function __construct(
51 int $initialTimeoutSeconds = 2400,
52 int $incrementalTimeoutSeconds = 600
55 $this->cache = $cache;
58 $this->initialTimeoutSeconds = $initialTimeoutSeconds;
59 $this->incrementalTimeoutSeconds = $incrementalTimeoutSeconds;
68 $groupsInSyncEntries = $this->cache->getByTag( self::GROUP_LIST_TAG );
70 foreach ( $groupsInSyncEntries as $entry ) {
71 $groups[] = $entry->value();
79 $expTime = $this->getExpireTime( $this->initialTimeoutSeconds );
82 $this->getGroupKey( $groupId ),
88 $this->logger->debug(
'Started sync for group {groupId}', [
'groupId' => $groupId ] );
91 public function getSyncEndTime(
string $groupId ): ?int {
92 $cacheEntry = $this->cache->get( $this->getGroupKey( $groupId ) );
93 return $cacheEntry ? $cacheEntry[0]->exptime() :
null;
97 public function endSync(
string $groupId ): void {
98 if ( $this->cache->hasEntryWithTag( $this->getGroupTag( $groupId ) ) ) {
99 throw new InvalidArgumentException(
100 'Cannot end synchronization for a group that still has messages to be processed.'
104 $groupKey = $this->getGroupKey( $groupId );
105 $this->cache->delete( $groupKey );
106 $this->logger->debug(
'Ended sync for group {groupId}', [
'groupId' => $groupId ] );
111 $this->cache->deleteEntriesWithTag( $this->getGroupTag( $groupId ) );
112 $this->endSync( $groupId );
118 $groupTag = $this->getGroupTag( $groupId );
119 foreach ( $messageParams as $messageParam ) {
120 $titleKey = $this->getMessageKeys( $groupId, $messageParam->getPageName() )[0];
129 $this->cache->set( ...$messagesToAdd );
134 $groupEntry = $this->cache->get( $this->getGroupKey( $groupId ) );
135 return $groupEntry !== [];
145 $messageEntries = $this->cache->getByTag( $this->getGroupTag( $groupId ) );
147 $allMessageParams = [];
148 foreach ( $messageEntries as $entry ) {
149 $message = $entry->value();
151 $allMessageParams[$message->getPageName()] = $message;
154 throw $this->invalidArgument( $message, MessageUpdateParameter::class );
158 return $allMessageParams;
163 $messageCacheKey = $this->getMessageKeys( $groupId, $messageKey );
164 return $this->cache->has( $messageCacheKey[0] );
169 if ( !$this->isGroupBeingProcessed( $groupId ) ) {
171 throw new LogicException(
172 'Sync requested for a group currently not being processed. Check if ' .
173 'group is being processed by calling isGroupBeingProcessed() first'
177 $remainingMessages = $this->getGroupMessages( $groupId );
180 if ( !$remainingMessages ) {
184 $syncExpTime = $this->getSyncEndTime( $groupId );
185 if ( $syncExpTime ===
null ) {
187 throw new RuntimeException(
188 "Unexpected condition. Group: $groupId; Messages present, but group key not found."
192 $hasTimedOut = $this->hasGroupTimedOut( $syncExpTime );
194 return new GroupSynchronizationResponse(
202 public function removeMessages(
string $groupId,
string ...$messageKeys ): void {
203 $messageCacheKeys = $this->getMessageKeys( $groupId, ...$messageKeys );
205 $this->cache->delete( ...$messageCacheKeys );
209 $groupId = $response->getGroupId();
212 if ( !$remainingMessages ) {
213 throw new LogicException(
'Cannot add a group without any remaining messages to the errors list' );
216 $groupMessageErrorTag = $this->getGroupMessageErrorTag( $groupId );
219 foreach ( $remainingMessages as $messageParam ) {
220 $titleErrorKey = $this->getMessageErrorKey( $groupId, $messageParam->getPageName() )[0];
221 $entriesToSave[] =
new PersistentCacheEntry(
225 $groupMessageErrorTag
229 $this->cache->set( ...$entriesToSave );
231 $groupErrorKey = $this->getGroupErrorKey( $groupId );
234 $groupInfo = $this->cache->get( $groupErrorKey );
243 $trimmedGroupSyncResponse =
new GroupSynchronizationResponse(
246 $response->hasTimedOut()
249 $entriesToSave[] =
new PersistentCacheEntry(
251 $trimmedGroupSyncResponse,
253 self::GROUP_ERROR_TAG
256 $this->cache->set( ...$entriesToSave );
264 $groupsInSyncEntries = $this->cache->getByTag( self::GROUP_ERROR_TAG );
266 foreach ( $groupsInSyncEntries as $entry ) {
267 $groupResponse = $entry->value();
269 $groupIds[] = $groupResponse->getGroupId();
272 throw $this->invalidArgument( $groupResponse, GroupSynchronizationResponse::class );
281 $groupMessageErrorTag = $this->getGroupMessageErrorTag( $groupId );
282 $groupMessageEntries = $this->cache->getByTag( $groupMessageErrorTag );
284 $groupErrorKey = $this->getGroupErrorKey( $groupId );
285 $groupResponseEntry = $this->cache->get( $groupErrorKey );
286 $groupResponse = $groupResponseEntry[0] ? $groupResponseEntry[0]->value() :
null;
287 if ( $groupResponse ) {
290 throw $this->invalidArgument( $groupResponse, GroupSynchronizationResponse::class );
293 throw new LogicException(
'Requested to fetch errors for a group that has no errors.' );
297 foreach ( $groupMessageEntries as $messageEntries ) {
298 $messageParam = $messageEntries->value();
299 if ( $messageParam instanceof MessageUpdateParameter ) {
300 $messageParams[] = $messageParam;
303 throw $this->invalidArgument( $messageParam, MessageUpdateParameter::class );
307 return new GroupSynchronizationResponse(
310 $groupResponse->hasTimedOut()
316 $groupSyncResponse = $this->getGroupErrorInfo( $groupId );
319 $errorMessageKeys = [];
320 foreach ( $errorMessages as $message ) {
321 $errorMessageKeys[] = $this->getMessageErrorKey( $groupId, $message->getPageName() )[0];
324 $this->cache->delete( ...$errorMessageKeys );
325 return $this->syncGroupErrors( $groupId );
330 $messageErrorKey = $this->getMessageErrorKey( $groupId, $messagePageName )[0];
331 $messageInCache = $this->cache->get( $messageErrorKey );
332 if ( !$messageInCache ) {
333 throw new InvalidArgumentException(
334 'Message does not appear to have synchronization errors'
338 $this->cache->delete( $messageErrorKey );
343 $groupErrorKey = $this->getGroupErrorKey( $groupId );
344 return $this->cache->has( $groupErrorKey );
349 $groupSyncResponse = $this->getGroupErrorInfo( $groupId );
350 if ( $groupSyncResponse->getRemainingMessages() ) {
351 return $groupSyncResponse;
355 $groupErrorKey = $this->getGroupErrorKey( $groupId );
356 $this->cache->delete( $groupErrorKey );
358 return $groupSyncResponse;
366 $groupsInReviewEntries = $this->cache->getByTag( self::GROUP_IN_REVIEW_TAG );
368 foreach ( $groupsInReviewEntries as $entry ) {
369 $groups[] = $entry->value();
375 public function markGroupAsInReview(
string $groupId ): void {
376 $groupReviewKey = $this->getGroupReviewKey( $groupId );
378 new PersistentCacheEntry(
382 self::GROUP_IN_REVIEW_TAG
385 $this->logger->debug(
'Group {groupId} marked for review', [
'groupId' => $groupId ] );
388 public function markGroupAsReviewed(
string $groupId ): void {
389 $groupReviewKey = $this->getGroupReviewKey( $groupId );
390 $this->cache->delete( $groupReviewKey );
391 $this->logger->debug(
'Group {groupId} removed from review', [
'groupId' => $groupId ] );
394 public function isGroupInReview(
string $groupId ): bool {
395 return $this->cache->has( $this->getGroupReviewKey( $groupId ) );
398 public function extendGroupExpiryTime(
string $groupId ): void {
399 $groupKey = $this->getGroupKey( $groupId );
400 $groupEntry = $this->cache->get( $groupKey );
402 if ( $groupEntry === [] ) {
404 throw new LogicException(
405 'Requested extension of expiry time for a group that is not being processed. ' .
406 'Check if group is being processed by calling isGroupBeingProcessed() first'
410 if ( $groupEntry[0]->hasExpired() ) {
411 throw new InvalidArgumentException(
412 'Cannot extend expiry time for a group that has already expired.'
416 $newExpiryTime = $this->getExpireTime( $this->incrementalTimeoutSeconds );
420 if ( $newExpiryTime < $groupEntry[0]->exptime() ) {
424 $this->cache->setExpiry( $groupKey, $newExpiryTime );
428 public function getGroupExpiryTime(
string $groupId ): int {
429 $groupKey = $this->getGroupKey( $groupId );
430 $groupEntry = $this->cache->get( $groupKey );
431 if ( $groupEntry === [] ) {
432 throw new InvalidArgumentException(
"$groupId currently not in processing!" );
435 return $groupEntry[0]->exptime();
438 private function hasGroupTimedOut(
int $syncExpTime ): bool {
439 return ( new DateTime() )->getTimestamp() > $syncExpTime;
442 private function getExpireTime(
int $timeoutSeconds ): int {
443 $currentTime = ( new DateTime() )->getTimestamp();
444 return (
new DateTime() )
445 ->setTimestamp( $currentTime + $timeoutSeconds )
449 private function invalidArgument( $value,
string $expectedType ): RuntimeException {
450 $valueType = get_debug_type( $value );
451 return new RuntimeException(
"Expected $expectedType, got $valueType" );
456 private function getGroupTag(
string $groupId ): string {
460 private function getGroupKey(
string $groupId ): string {
461 $hash = substr( hash(
'sha256', $groupId ), 0, 40 );
462 return substr(
"{$hash}_$groupId", 0, 255 );
466 private function getMessageKeys(
string $groupId,
string ...$messages ): array {
468 foreach ( $messages as $message ) {
469 $key = $groupId .
'_' . $message;
470 $hash = substr( hash(
'sha256', $key ), 0, 40 );
471 $finalKey = substr( $hash .
'_' . $key, 0, 255 );
472 $messageKeys[] = $finalKey;
478 private function getGroupErrorKey(
string $groupId ): string {
479 $hash = substr( hash(
'sha256', $groupId ), 0, 40 );
480 return substr(
"{$hash}_gsc_error_$groupId", 0, 255 );
484 private function getMessageErrorKey(
string $groupId,
string ...$messages ): array {
486 foreach ( $messages as $message ) {
487 $key = $groupId .
'_' . $message;
488 $hash = substr( hash(
'sha256', $key ), 0, 40 );
489 $finalKey = substr( $hash .
'_gsc_error_' . $key, 0, 255 );
490 $messageKeys[] = $finalKey;
496 private function getGroupMessageErrorTag(
string $groupId ): string {
497 return "gsc_%error%_$groupId";
500 private function getGroupReviewKey(
string $groupId ): string {
501 $hash = substr( hash(
'sha256', $groupId ), 0, 40 );
502 return substr(
"{$hash}_gsc_%review%_$groupId", 0, 255 );
return[ 'Translate:AggregateGroupManager'=> static function(MediaWikiServices $services):AggregateGroupManager { return new AggregateGroupManager($services->getTitleFactory(), $services->get( 'Translate:MessageGroupMetadata'));}, 'Translate:AggregateGroupMessageGroupFactory'=> static function(MediaWikiServices $services):AggregateGroupMessageGroupFactory { return new AggregateGroupMessageGroupFactory($services->get( 'Translate:MessageGroupMetadata'));}, 'Translate:ConfigHelper'=> static function():ConfigHelper { return new ConfigHelper();}, 'Translate:CsvTranslationImporter'=> static function(MediaWikiServices $services):CsvTranslationImporter { return new CsvTranslationImporter( $services->getWikiPageFactory());}, 'Translate:EntitySearch'=> static function(MediaWikiServices $services):EntitySearch { return new EntitySearch($services->getMainWANObjectCache(), $services->getCollationFactory() ->makeCollation( 'uca-default-u-kn'), MessageGroups::singleton(), $services->getNamespaceInfo(), $services->get( 'Translate:MessageIndex'), $services->getTitleParser(), $services->getTitleFormatter());}, 'Translate:ExternalMessageSourceStateComparator'=> static function(MediaWikiServices $services):ExternalMessageSourceStateComparator { return new ExternalMessageSourceStateComparator(new SimpleStringComparator(), $services->getRevisionLookup(), $services->getPageStore());}, 'Translate:ExternalMessageSourceStateImporter'=> static function(MediaWikiServices $services):ExternalMessageSourceStateImporter { return new ExternalMessageSourceStateImporter($services->get( 'Translate:GroupSynchronizationCache'), $services->getJobQueueGroup(), LoggerFactory::getInstance(LogNames::GROUP_SYNCHRONIZATION), $services->get( 'Translate:MessageIndex'), $services->getTitleFactory(), $services->get( 'Translate:MessageGroupSubscription'), new ServiceOptions(ExternalMessageSourceStateImporter::CONSTRUCTOR_OPTIONS, $services->getMainConfig()));}, 'Translate:FileBasedMessageGroupFactory'=> static function(MediaWikiServices $services):FileBasedMessageGroupFactory { return new FileBasedMessageGroupFactory(new MessageGroupConfigurationParser(), new ServiceOptions(FileBasedMessageGroupFactory::SERVICE_OPTIONS, $services->getMainConfig()),);}, 'Translate:FileFormatFactory'=> static function(MediaWikiServices $services):FileFormatFactory { return new FileFormatFactory( $services->getObjectFactory());}, 'Translate:GroupSynchronizationCache'=> static function(MediaWikiServices $services):GroupSynchronizationCache { return new GroupSynchronizationCache( $services->get( 'Translate:PersistentCache'));}, 'Translate:HookDefinedMessageGroupFactory'=> static function(MediaWikiServices $services):HookDefinedMessageGroupFactory { return new HookDefinedMessageGroupFactory( $services->get( 'Translate:HookRunner'));}, 'Translate:HookRunner'=> static function(MediaWikiServices $services):HookRunner { return new HookRunner( $services->getHookContainer());}, 'Translate:MessageBundleDependencyPurger'=> static function(MediaWikiServices $services):MessageBundleDependencyPurger { return new MessageBundleDependencyPurger( $services->get( 'Translate:TranslatableBundleFactory'));}, 'Translate:MessageBundleMessageGroupFactory'=> static function(MediaWikiServices $services):MessageBundleMessageGroupFactory { return new MessageBundleMessageGroupFactory($services->get( 'Translate:MessageGroupMetadata'), new ServiceOptions(MessageBundleMessageGroupFactory::SERVICE_OPTIONS, $services->getMainConfig()),);}, 'Translate:MessageBundleStore'=> static function(MediaWikiServices $services):MessageBundleStore { return new MessageBundleStore($services->get( 'Translate:RevTagStore'), $services->getJobQueueGroup(), $services->getLanguageNameUtils(), $services->get( 'Translate:MessageIndex'), $services->get( 'Translate:MessageGroupMetadata'));}, 'Translate:MessageBundleTranslationLoader'=> static function(MediaWikiServices $services):MessageBundleTranslationLoader { return new MessageBundleTranslationLoader( $services->getLanguageFallback());}, 'Translate:MessageGroupMetadata'=> static function(MediaWikiServices $services):MessageGroupMetadata { return new MessageGroupMetadata( $services->getConnectionProvider());}, 'Translate:MessageGroupReviewStore'=> static function(MediaWikiServices $services):MessageGroupReviewStore { return new MessageGroupReviewStore($services->getConnectionProvider(), $services->get( 'Translate:HookRunner'));}, 'Translate:MessageGroupStatsTableFactory'=> static function(MediaWikiServices $services):MessageGroupStatsTableFactory { return new MessageGroupStatsTableFactory($services->get( 'Translate:ProgressStatsTableFactory'), $services->getLinkRenderer(), $services->get( 'Translate:MessageGroupReviewStore'), $services->get( 'Translate:MessageGroupMetadata'), $services->getMainConfig() ->get( 'TranslateWorkflowStates') !==false);}, 'Translate:MessageGroupSubscription'=> static function(MediaWikiServices $services):MessageGroupSubscription { return new MessageGroupSubscription($services->get( 'Translate:MessageGroupSubscriptionStore'), $services->getJobQueueGroup(), $services->getUserIdentityLookup(), LoggerFactory::getInstance(LogNames::GROUP_SUBSCRIPTION), new ServiceOptions(MessageGroupSubscription::CONSTRUCTOR_OPTIONS, $services->getMainConfig()));}, 'Translate:MessageGroupSubscriptionHookHandler'=> static function(MediaWikiServices $services):MessageGroupSubscriptionHookHandler { return new MessageGroupSubscriptionHookHandler($services->get( 'Translate:MessageGroupSubscription'), $services->getUserFactory());}, 'Translate:MessageGroupSubscriptionStore'=> static function(MediaWikiServices $services):MessageGroupSubscriptionStore { return new MessageGroupSubscriptionStore( $services->getConnectionProvider());}, 'Translate:MessageIndex'=> static function(MediaWikiServices $services):MessageIndex { $params=(array) $services->getMainConfig() ->get( 'TranslateMessageIndex');$class=array_shift( $params);$implementationMap=['HashMessageIndex'=> HashMessageIndex::class, 'CDBMessageIndex'=> CDBMessageIndex::class, 'DatabaseMessageIndex'=> DatabaseMessageIndex::class, 'hash'=> HashMessageIndex::class, 'cdb'=> CDBMessageIndex::class, 'database'=> DatabaseMessageIndex::class,];$messageIndexStoreClass=$implementationMap[$class] ?? $implementationMap['database'];return new MessageIndex(new $messageIndexStoreClass, $services->getMainWANObjectCache(), $services->getJobQueueGroup(), $services->get( 'Translate:HookRunner'), LoggerFactory::getInstance(LogNames::MAIN), $services->getMainObjectStash(), $services->getConnectionProvider(), new ServiceOptions(MessageIndex::SERVICE_OPTIONS, $services->getMainConfig()),);}, 'Translate:MessagePrefixStats'=> static function(MediaWikiServices $services):MessagePrefixStats { return new MessagePrefixStats( $services->getTitleParser());}, 'Translate:ParsingPlaceholderFactory'=> static function():ParsingPlaceholderFactory { return new ParsingPlaceholderFactory();}, 'Translate:PersistentCache'=> static function(MediaWikiServices $services):PersistentCache { return new PersistentDatabaseCache($services->getConnectionProvider(), $services->getJsonCodec());}, 'Translate:ProgressStatsTableFactory'=> static function(MediaWikiServices $services):ProgressStatsTableFactory { return new ProgressStatsTableFactory($services->getLinkRenderer(), $services->get( 'Translate:ConfigHelper'), $services->get( 'Translate:MessageGroupMetadata'));}, 'Translate:RevTagStore'=> static function(MediaWikiServices $services):RevTagStore { return new RevTagStore( $services->getConnectionProvider());}, 'Translate:SubpageListBuilder'=> static function(MediaWikiServices $services):SubpageListBuilder { return new SubpageListBuilder($services->get( 'Translate:TranslatableBundleFactory'), $services->getLinkBatchFactory());}, 'Translate:TranslatableBundleDeleter'=> static function(MediaWikiServices $services):TranslatableBundleDeleter { return new TranslatableBundleDeleter($services->getMainObjectStash(), $services->getJobQueueGroup(), $services->get( 'Translate:SubpageListBuilder'), $services->get( 'Translate:TranslatableBundleFactory'));}, 'Translate:TranslatableBundleExporter'=> static function(MediaWikiServices $services):TranslatableBundleExporter { return new TranslatableBundleExporter($services->get( 'Translate:SubpageListBuilder'), $services->getWikiExporterFactory(), $services->getConnectionProvider());}, 'Translate:TranslatableBundleFactory'=> static function(MediaWikiServices $services):TranslatableBundleFactory { return new TranslatableBundleFactory($services->get( 'Translate:TranslatablePageStore'), $services->get( 'Translate:MessageBundleStore'));}, 'Translate:TranslatableBundleImporter'=> static function(MediaWikiServices $services):TranslatableBundleImporter { return new TranslatableBundleImporter($services->getWikiImporterFactory(), $services->get( 'Translate:TranslatablePageParser'), $services->getRevisionLookup(), $services->getNamespaceInfo(), $services->getTitleFactory(), $services->getFormatterFactory());}, 'Translate:TranslatableBundleMover'=> static function(MediaWikiServices $services):TranslatableBundleMover { return new TranslatableBundleMover($services->getMovePageFactory(), $services->getJobQueueGroup(), $services->getLinkBatchFactory(), $services->get( 'Translate:TranslatableBundleFactory'), $services->get( 'Translate:SubpageListBuilder'), $services->getConnectionProvider(), $services->getObjectCacheFactory(), $services->getMainConfig() ->get( 'TranslatePageMoveLimit'));}, 'Translate:TranslatableBundleStatusStore'=> static function(MediaWikiServices $services):TranslatableBundleStatusStore { return new TranslatableBundleStatusStore($services->getConnectionProvider() ->getPrimaryDatabase(), $services->getCollationFactory() ->makeCollation( 'uca-default-u-kn'), $services->getDBLoadBalancer() ->getMaintenanceConnectionRef(DB_PRIMARY));}, 'Translate:TranslatablePageMarker'=> static function(MediaWikiServices $services):TranslatablePageMarker { return new TranslatablePageMarker($services->getConnectionProvider(), $services->getJobQueueGroup(), $services->getLinkRenderer(), MessageGroups::singleton(), $services->get( 'Translate:MessageIndex'), $services->getTitleFormatter(), $services->getTitleParser(), $services->get( 'Translate:TranslatablePageParser'), $services->get( 'Translate:TranslatablePageStore'), $services->get( 'Translate:TranslatablePageStateStore'), $services->get( 'Translate:TranslationUnitStoreFactory'), $services->get( 'Translate:MessageGroupMetadata'), $services->getWikiPageFactory(), $services->get( 'Translate:TranslatablePageView'), $services->get( 'Translate:MessageGroupSubscription'), $services->getFormatterFactory());}, 'Translate:TranslatablePageMessageGroupFactory'=> static function(MediaWikiServices $services):TranslatablePageMessageGroupFactory { return new TranslatablePageMessageGroupFactory(new ServiceOptions(TranslatablePageMessageGroupFactory::SERVICE_OPTIONS, $services->getMainConfig()),);}, 'Translate:TranslatablePageParser'=> static function(MediaWikiServices $services):TranslatablePageParser { return new TranslatablePageParser($services->get( 'Translate:ParsingPlaceholderFactory'));}, 'Translate:TranslatablePageStateStore'=> static function(MediaWikiServices $services):TranslatablePageStateStore { return new TranslatablePageStateStore($services->get( 'Translate:PersistentCache'), $services->getPageStore());}, 'Translate:TranslatablePageStore'=> static function(MediaWikiServices $services):TranslatablePageStore { return new TranslatablePageStore($services->get( 'Translate:MessageIndex'), $services->getJobQueueGroup(), $services->get( 'Translate:RevTagStore'), $services->getConnectionProvider(), $services->get( 'Translate:TranslatableBundleStatusStore'), $services->get( 'Translate:TranslatablePageParser'), $services->get( 'Translate:MessageGroupMetadata'));}, 'Translate:TranslatablePageView'=> static function(MediaWikiServices $services):TranslatablePageView { return new TranslatablePageView($services->getConnectionProvider(), $services->get( 'Translate:TranslatablePageStateStore'), new ServiceOptions(TranslatablePageView::SERVICE_OPTIONS, $services->getMainConfig()));}, 'Translate:TranslateSandbox'=> static function(MediaWikiServices $services):TranslateSandbox { return new TranslateSandbox($services->getUserFactory(), $services->getConnectionProvider(), $services->getPermissionManager(), $services->getAuthManager(), $services->getUserGroupManager(), $services->getActorStore(), $services->getUserOptionsManager(), $services->getJobQueueGroup(), $services->get( 'Translate:HookRunner'), new ServiceOptions(TranslateSandbox::CONSTRUCTOR_OPTIONS, $services->getMainConfig()));}, 'Translate:TranslationStashReader'=> static function(MediaWikiServices $services):TranslationStashReader { return new TranslationStashStorage( $services->getConnectionProvider() ->getPrimaryDatabase());}, 'Translate:TranslationStatsDataProvider'=> static function(MediaWikiServices $services):TranslationStatsDataProvider { return new TranslationStatsDataProvider(new ServiceOptions(TranslationStatsDataProvider::CONSTRUCTOR_OPTIONS, $services->getMainConfig()), $services->getObjectFactory(), $services->getConnectionProvider());}, 'Translate:TranslationUnitStoreFactory'=> static function(MediaWikiServices $services):TranslationUnitStoreFactory { return new TranslationUnitStoreFactory( $services->getDBLoadBalancer());}, 'Translate:TranslatorActivity'=> static function(MediaWikiServices $services):TranslatorActivity { $query=new TranslatorActivityQuery($services->getMainConfig(), $services->getDBLoadBalancer());return new TranslatorActivity($services->getMainObjectStash(), $query, $services->getJobQueueGroup());}, 'Translate:TtmServerFactory'=> static function(MediaWikiServices $services):TtmServerFactory { $config=$services->getMainConfig();$default=$config->get( 'TranslateTranslationDefaultService');if( $default===false) { $default=null;} return new TtmServerFactory( $config->get( 'TranslateTranslationServices'), $default);}]
@phpcs-require-sorted-array