diff options
author | Brian Evans <grknight@gentoo.org> | 2020-10-02 13:57:00 -0400 |
---|---|---|
committer | Brian Evans <grknight@gentoo.org> | 2020-10-02 13:57:00 -0400 |
commit | ab2071c71446a71888e4c9762cdce102bf9e29a3 (patch) | |
tree | 9ce07fbfd979a5898f21239c8f8f5b3d3cbdfc21 /Echo/ServiceWiring.php | |
parent | Add PluggableAuth extension for OpenID Connect (diff) | |
download | extensions-ab2071c71446a71888e4c9762cdce102bf9e29a3.tar.gz extensions-ab2071c71446a71888e4c9762cdce102bf9e29a3.tar.bz2 extensions-ab2071c71446a71888e4c9762cdce102bf9e29a3.zip |
Update Echo to 1.35
Signed-off-by: Brian Evans <grknight@gentoo.org>
Diffstat (limited to 'Echo/ServiceWiring.php')
-rw-r--r-- | Echo/ServiceWiring.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Echo/ServiceWiring.php b/Echo/ServiceWiring.php new file mode 100644 index 00000000..62558f25 --- /dev/null +++ b/Echo/ServiceWiring.php @@ -0,0 +1,49 @@ +<?php + +use EchoPush\NotificationServiceClient; +use EchoPush\SubscriptionManager; +use MediaWiki\Logger\LoggerFactory; +use MediaWiki\MediaWikiServices; +use MediaWiki\Storage\NameTableStore; + +return [ + + 'EchoPushNotificationServiceClient' => function ( MediaWikiServices $services ): + NotificationServiceClient { + $echoConfig = $services->getConfigFactory()->makeConfig( 'Echo' ); + $httpRequestFactory = $services->getHttpRequestFactory(); + $url = $echoConfig->get( 'EchoPushServiceBaseUrl' ); + $client = new NotificationServiceClient( $httpRequestFactory, $url ); + $client->setLogger( LoggerFactory::getInstance( 'Echo' ) ); + return $client; + }, + + 'EchoPushSubscriptionManager' => function ( MediaWikiServices $services ): SubscriptionManager { + $echoConfig = $services->getConfigFactory()->makeConfig( 'Echo' ); + // Use shared DB/cluster for push subscriptions + $cluster = $echoConfig->get( 'EchoSharedTrackingCluster' ); + $database = $echoConfig->get( 'EchoSharedTrackingDB' ); + $loadBalancerFactory = $services->getDBLoadBalancerFactory(); + $loadBalancer = $cluster + ? $loadBalancerFactory->getExternalLB( $cluster ) + : $loadBalancerFactory->getMainLB( $database ); + $dbw = $loadBalancer->getLazyConnectionRef( DB_MASTER, [], $database ); + $dbr = $loadBalancer->getLazyConnectionRef( DB_REPLICA, [], $database ); + + $centralIdLookup = CentralIdLookup::factory(); + + $pushProviderStore = new NameTableStore( + $loadBalancer, + $services->getMainWANObjectCache(), + LoggerFactory::getInstance( 'Echo' ), + 'echo_push_provider', + 'epp_id', + 'epp_name', + null, + $database + ); + + return new SubscriptionManager( $dbw, $dbr, $centralIdLookup, $pushProviderStore ); + } + +]; |