MediaWiki  1.23.8
Go to the documentation of this file.
1 <?php
35  protected $factoryFunctions = array();
42  protected $configs = array();
44  public static function getDefaultInstance() {
45  static $self = null;
46  if ( !$self ) {
47  $self = new self;
48  global $wgConfigRegistry;
49  foreach ( $wgConfigRegistry as $name => $callback ) {
50  $self->register( $name, $callback );
51  }
52  }
53  return $self;
54  }
63  public function register( $name, $callback ) {
64  if ( !is_callable( $callback ) ) {
65  throw new InvalidArgumentException( 'Invalid callback provided' );
66  }
67  $this->factoryFunctions[$name] = $callback;
68  }
79  public function makeConfig( $name ) {
80  if ( !isset( $this->configs[$name] ) ) {
81  if ( !isset( $this->factoryFunctions[$name] ) ) {
82  throw new ConfigException( "No registered builder available for $name." );
83  }
84  $conf = call_user_func( $this->factoryFunctions[$name], $this );
85  if ( $conf instanceof Config ) {
86  $this->configs[$name] = $conf;
87  } else {
88  throw new UnexpectedValueException( "The builder for $name returned a non-Config object." );
89  }
90  }
92  return $this->configs[$name];
93  }
94 }
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
array $configs
Config objects that have already been created name => Config object.
Definition: ConfigFactory.php:40
Interface for configuration instances.
Definition: Config.php:28
static getDefaultInstance()
Definition: ConfigFactory.php:42
Exceptions for config failures.
Definition: ConfigException.php:28
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
makeConfig( $name)
Create a given Config using the registered callback for $name.
Definition: ConfigFactory.php:77
Definition: doMaintenance.php:54
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
Factory class to create Config objects.
Definition: ConfigFactory.php:29
array $factoryFunctions
Map of config name => callback.
Definition: ConfigFactory.php:34