@tsteur opened this Pull Request on October 13th 2019 Member

Allows a bootstrap file to change config settings like by creating a bootstrap.php and then having eg

// matomo/bootstrap.php
$GLOBALS['MATOMO_MODIFY_CONFIG_SETTINGS'] = function ($settings) {
    $settings['Plugins'][] = 'MyPlugin';
         return $settings;
});

It's mainly useful to configure the list of plugins as pretty much all other settings can be configured through DI when the config is being created. I was doing this initially here as well for quite some time until I noticed a problem with an incompatible plugin and had to do it this way. The problem is that when changing the list of activated plugins dynamically through DI, then the plugin config.php files aren't loaded correctly. The order is:

  1. Get activated plugins
  2. Load plugin config.php files when building DI container
  3. Run DI container for config class

This means when adding eg TagManager through DI to the list of activated plugins then the config.php of TagManager will never be loaded and it always results in errors. Instead of in step 3 I needed to make the change in step 1.

Not documenting this for now as it would usually never be needed and we don't want to support this just yet.

This Pull Request was closed on October 13th 2019
Powered by GitHub Issue Mirror