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

Sort the name of modules before saving them to config.php #24539

Closed
wants to merge 1 commit into from

Conversation

reense
Copy link
Contributor

@reense reense commented Sep 10, 2019

Description (*)

I've added a simple ksort() before all the modules are saved to the app/etc/config.php file. With this change, the modules in this file now get sorted alphabetically.

This currently is a problem because everytime you run setup:upgrade, Magento will alter the order of this module list. Git will register this as a change, preventing from updating your store using a simple git pull. It's more an annoyance than a real problem.

Fixed Issues (if relevant)

None.

Manual testing scenarios (*)

  1. Run setup:upgrade on a clean Magento installation.
  2. Open app/etc/config.php
  3. All the values of the modules key should have been sorted alphabetically.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@m2-assistant
Copy link

m2-assistant bot commented Sep 10, 2019

Hi @reense. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Guide documentation.

@dmytro-ch
Copy link
Contributor

Hi @reense,
the flow you described is actually correct:

everytime you run setup:upgrade, Magento will alter the order of this module list. Git will register this as a change, preventing from updating your store using a simple git pull. It's more an annoyance than a real problem.

The app/etc/config.php is being updated as a result of bin/magento setup:upgrade execution, according to the modules dependency sequence.

There is also bin/magento: module:config:status command available for validating the app/etc/config.php file. For more details please check the following PR: #22733

Thank you!

@dmytro-ch dmytro-ch closed this Sep 10, 2019
@m2-assistant
Copy link

m2-assistant bot commented Sep 10, 2019

Hi @reense, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

@hostep
Copy link
Contributor

hostep commented Sep 10, 2019

Just to add something interesting here: PR 21020 already added a better way for sorting modules in the config.php file. I'm not super convinced of the change, but it seems to work quite well in practice. This change is only available since Magento 2.3.2.

@reense: if you aren't on Magento 2.3.2 yet I can understand your frustration, but since Magento 2.3.2 the changes in the config.php file have become a lot more cleaner/manageable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants