MediaWiki REL1_32
EventRelayerGroup.php
Go to the documentation of this file.
1<?php
22
30 protected $configByChannel = [];
31
33 protected $relayers = [];
34
38 public function __construct( array $config ) {
39 $this->configByChannel = $config;
40 }
41
46 public static function singleton() {
47 wfDeprecated( __METHOD__, '1.27' );
48 return MediaWikiServices::getInstance()->getEventRelayerGroup();
49 }
50
55 public function getRelayer( $channel ) {
56 $channelKey = isset( $this->configByChannel[$channel] )
57 ? $channel
58 : 'default';
59
60 if ( !isset( $this->relayers[$channelKey] ) ) {
61 if ( !isset( $this->configByChannel[$channelKey] ) ) {
62 throw new UnexpectedValueException( "No config for '$channelKey'" );
63 }
64
65 $config = $this->configByChannel[$channelKey];
66 $class = $config['class'];
67
68 $this->relayers[$channelKey] = new $class( $config );
69 }
70
71 return $this->relayers[$channelKey];
72 }
73}
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Factory class for spawning EventRelayer objects using configuration.
__construct(array $config)
EventRelayer[] $relayers
Base class for reliable event relays.
MediaWikiServices is the service locator for the application scope of MediaWiki.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))