37 protected $factoryFunctions = [];
44 protected $configs = [];
52 return \MediaWiki\MediaWikiServices::getInstance()->getConfigFactory();
67 Assert::parameterType( self::class, $other,
'$other' );
70 foreach ( $other->factoryFunctions as $name => $otherFunc ) {
71 if ( !
isset( $this->factoryFunctions[$name] ) ) {
77 if (
isset( $other->configs[$name] )
78 && $this->factoryFunctions[$name] == $otherFunc
80 $this->configs[
$name] = $other->configs[
$name];
81 unset( $other->configs[$name] );
86 $other->factoryFunctions = [];
106 public function register(
$name, $callback ) {
109 $callback =
'[ ' . implode(
', ', $callback ) .
' ]';
111 $callback =
'instanceof ' .
get_class( $callback );
113 throw new InvalidArgumentException(
'Invalid callback \'' . $callback .
'\' provided
' );
116 unset( $this->configs[$name] );
117 $this->factoryFunctions[$name] = $callback;
129 public function makeConfig( $name ) {
130 if ( !isset( $this->configs[$name] ) ) {
132 if ( !isset( $this->factoryFunctions[$key] ) ) {
135 if ( !isset( $this->factoryFunctions[$key] ) ) {
136 throw new ConfigException( "No registered builder available for $name." );
139 if ( $this->factoryFunctions[$key] instanceof Config ) {
140 $conf = $this->factoryFunctions[$key];
142 $conf = call_user_func( $this->factoryFunctions[$key], $this );
145 if ( $conf instanceof Config ) {
146 $this->configs[$name] = $conf;
148 throw new UnexpectedValueException( "The builder for $name returned a non-Config object." );
152 return $this->configs[$name];
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
Factory class to create Config objects.
static getDefaultInstance()
salvage(SalvageableService $other)
Re-uses existing Cache objects from $other.
array $factoryFunctions
Map of config name => callback.
array $configs
Config objects that have already been created name => Config object.
Allows to change the fields on the form that will be generated $name
Interface for configuration instances.
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))