registration: Expose config array to ExtensionRegistry
authorFlorian Schmidt <florian.schmidt.stargatewissen@gmail.com>
Fri, 13 Jan 2017 05:21:00 +0000 (06:21 +0100)
committerKunal Mehta <legoktm@member.fsf.org>
Thu, 19 Jul 2018 13:59:15 +0000 (15:59 +0200)
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
includes/registration/ExtensionRegistry.php
includes/registration/Processor.php

index a803e3a..d0a9871 100644 (file)
@@ -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;
                        }
                }
        }
index c58b55e..d21ae41 100644 (file)
@@ -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
index 210deb1..636d3b3 100644 (file)
@@ -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