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
Make sure plugins in config.ini.php are sorted depending on dependencies #11683
Conversation
@@ -111,10 +114,73 @@ public function sortPlugins(array $plugins) | |||
$otherPluginsToLoadAfterDefaultPlugins = array_diff($plugins, $defaultPluginsLoadedFirst); | |||
|
|||
// sort by name to have a predictable order for those extra plugins | |||
sort($otherPluginsToLoadAfterDefaultPlugins); | |||
natcasesort($otherPluginsToLoadAfterDefaultPlugins); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We make sure to sort in natural order and to ignore lower / upper case
$sorted = array(); | ||
foreach ($otherPluginsToLoadAfterDefaultPlugins as $pluginName) { | ||
$sorted = $this->sortRequiredPlugin($pluginName, $pluginJsonCache, $otherPluginsToLoadAfterDefaultPlugins, $sorted); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we cannot use classic usort
here as it wouldn't sort correctly when "resolving" dependencies.
Tried to test this:
Is it supposed to work differently or my test procedure not correct? |
Your require looks wrong eg "1.0.0" is not a valid definition afaik. It definitely works see tests and also tested it manually. I would check the test procedure |
ok I'll check again. Which tests do you refer to? |
Forgot to commit the tests, just did |
Then the re-order works as expected. And with the now added test file, PR is perfect 👍 |
fix #11681
Please note that this will be only executed when activating or removing a plugin. So existing configs won't be changed. AFAIK there are not really any plugins making much use of this feature and this should be fine and we don't need to run an update to change existing configs. It will only affect in which order the
config/config.php
files are loaded in each plugin. The actual plugins are still loaded alphabetically by the platform (unless a plugin is required).