Page MenuHomePhabricator

Create ConfigSink
Open, Needs TriagePublic

Description

Interface draft:

ConfigSink {
  public function set( string $key, mixed $value, MergeStrategy $merge = null );
}

Example implementations

GlobalVarConfigSink implements ConfigSink {
  public function __construct( $prefix = '' ) { ... }
  public function set( string $key, mixed $value, MergeStrategy $merge = null ) {
      // ...merge...
      $GLOBALS[$this->prefix . $key]  = $value;
  }
}

ConfigBuilder implements ConfigSink {
  public function __construct() { ... }
  public function set( string $key, mixed $value, MergeStrategy $merge = null ) {
      // ...merge...
      $this->config[$key]  = $value;
  }

  public function getConfig(): Config {
    return new HashConfig( $this->config );
  }
}
NOTE: this is part of prototyping a solution for T292402

Event Timeline

Change 737752 had a related patch set uploaded (by Ppchelko; author: Daniel Kinzler):

[mediawiki/core@master] WIP: SettingsBuilder

https://gerrit.wikimedia.org/r/737752

Change 737752 merged by jenkins-bot:

[mediawiki/core@master] Introducing SettingsBuilder for loading settings files.

https://gerrit.wikimedia.org/r/737752