Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin config of a required plugin should be loaded before the requiring plugin #11681

Closed
tsteur opened this issue May 9, 2017 · 0 comments · Fixed by #11683
Closed

Plugin config of a required plugin should be loaded before the requiring plugin #11681

tsteur opened this issue May 9, 2017 · 0 comments · Fixed by #11683
Labels
Bug For errors / faults / flaws / inconsistencies etc. c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself.

Comments

@tsteur
Copy link
Member

tsteur commented May 9, 2017

See comment in #11678 (comment)

There is an issue that plugins/$pluginName/config/config.php in each plugin is loaded alphabetically. Ideally, the config.php of a required plugin should have less of a priority so that a plugin that requires another plugin, can overwrite a DI setting of the required plugin.

Meaning if a plugin Acc requires a plugin Cli, then config for Cli should be loaded first, then Acc because Acc requires Cli. This way Acc could overwrite any DI setting from Cli.

Currently, config.php files are loaded as they are defined in config.ini.php which is usually alphabetically because of https://github.com/piwik/piwik/blob/3.0.4-b2/core/Plugin/Manager.php#L209-L212 and https://github.com/piwik/piwik/blob/3.0.4-b2/core/Application/Kernel/PluginList.php#L114 (if config file is writable and not changed manually).

I presume we could solve it by sorting the plugin list differently in https://github.com/piwik/piwik/blob/3.0.4-b2/core/Plugin/Manager.php#L209-L212 where we list custom plugins first alphabetically, but if there is required plugin we need to list that sort. As this involves looking into plugin.json files, we should not do this in the PluginList.php#L114 sort() as this would be slow on each request and instead only do it when being called in updatePluginsConfig https://github.com/piwik/piwik/blob/3.0.4-b2/core/Plugin/Manager.php#L209-L212

@tsteur tsteur added Bug For errors / faults / flaws / inconsistencies etc. c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself. labels May 9, 2017
tsteur added a commit that referenced this issue May 9, 2017
mattab pushed a commit that referenced this issue May 15, 2017
…ies (#11683)

* fix #11681 make sure plugins in config.ini.php are sorted depending on dependencies

* added comment

* add missing tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. c: Platform For Matomo platform changes that aren't impacting any of our APIs but improve the core itself.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant