From: Florian Schmidt Date: Fri, 13 Jan 2017 05:21:00 +0000 (+0100) Subject: registration: Expose config array to ExtensionRegistry X-Git-Tag: 1.34.0-rc.0~4710^2 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=488796a9c4e7ba0ee059a6765988fe47a20b94a9;p=lhc%2Fweb%2Fwiklou.git registration: Expose config array to ExtensionRegistry Currently, the ExtensionProcessor processes the config array of the extension and just sets the value as a global. In this way, however, the metadata of the configs (description, public, ...) aren't available. This change exposes the configurations in the extracted data as the config key. Bug: T155908 Change-Id: Ie41e6ecb8d08a5b20b56eb2281af1dfdd808b2c4 --- diff --git a/includes/registration/ExtensionProcessor.php b/includes/registration/ExtensionProcessor.php index a803e3a80d..d0a987116d 100644 --- a/includes/registration/ExtensionProcessor.php +++ b/includes/registration/ExtensionProcessor.php @@ -162,6 +162,11 @@ class ExtensionProcessor implements Processor { */ protected $credits = []; + /** + * @var array + */ + protected $config = []; + /** * Any thing else in the $info that hasn't * already been processed @@ -290,6 +295,7 @@ class ExtensionProcessor implements Processor { return [ 'globals' => $this->globals, + 'config' => $this->config, 'defines' => $this->defines, 'callbacks' => $this->callbacks, 'credits' => $this->credits, @@ -493,6 +499,11 @@ class ExtensionProcessor implements Processor { $value = "$dir/$value"; } $this->addConfigGlobal( "$prefix$key", $value, $info['name'] ); + $data['providedby'] = $info['name']; + if ( isset( $info['ConfigRegistry'][0] ) ) { + $data['configregistry'] = array_keys( $info['ConfigRegistry'] )[0]; + } + $this->config[$key] = $data; } } } diff --git a/includes/registration/ExtensionRegistry.php b/includes/registration/ExtensionRegistry.php index c58b55ebfd..d21ae412f1 100644 --- a/includes/registration/ExtensionRegistry.php +++ b/includes/registration/ExtensionRegistry.php @@ -36,7 +36,7 @@ class ExtensionRegistry { /** * Bump whenever the registration cache needs resetting */ - const CACHE_VERSION = 6; + const CACHE_VERSION = 7; /** * Special key that defines the merge strategy diff --git a/includes/registration/Processor.php b/includes/registration/Processor.php index 210deb1bde..636d3b3768 100644 --- a/includes/registration/Processor.php +++ b/includes/registration/Processor.php @@ -25,6 +25,7 @@ interface Processor { * @return array With following keys: * 'globals' - variables to be set to $GLOBALS * 'defines' - constants to define + * 'config' - configuration information * 'callbacks' - functions to be executed by the registry * 'credits' - metadata to be stored by registry * 'attributes' - registration info which isn't a global variable