From 488796a9c4e7ba0ee059a6765988fe47a20b94a9 Mon Sep 17 00:00:00 2001 From: Florian Schmidt Date: Fri, 13 Jan 2017 06:21:00 +0100 Subject: [PATCH] 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 --- includes/registration/ExtensionProcessor.php | 11 +++++++++++ includes/registration/ExtensionRegistry.php | 2 +- includes/registration/Processor.php | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) 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 -- 2.20.1