-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Add option "lock-config" for shell command "config:set" #12178
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
Add option "lock-config" for shell command "config:set" #12178
Conversation
I am not totally happy with the naming of the option. Instead of |
Thanks @avstudnitz - read your blog post on this and an addition like this totally makes sense. Agree that naming this is tricky. I would suggest the following: |
You can find the blog post about this functionality which was mentioned by @fooman at https://www.integer-net.com/magento-2-2-configuration-via-code/. |
Just referencing another PR with improvements in same area: |
I adjusted the PR accordingly (now using Virtual Classes to avoid code duplication) and updated the description. Thanks for the suggestion @fooman. |
@avstudnitz would you mind taking a look at this failure as well https://travis-ci.org/magento/magento2/jobs/306722542#L1031 which seems related. |
@fooman Done. |
* @since 100.2.0 | ||
*/ | ||
public function process($path, $value, $scope, $scopeCode, $lock) | ||
public function process($path, $value, $scope, $scopeCode, $lock, $lockTarget = ConfigFilePool::APP_ENV) |
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.
Unfortunately this backward incompatible change. Please follow the instruction here http://devdocs.magento.com/guides/v2.0/contributor-guide/backward-compatible-development/#adding-parameters-in-public-methods
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.
@okorshenko Can you explain to me why adding an optional parameter at the end should be backwards incompatible? I'd like to understand that.
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.
Hi @avstudnitz this class has annotation @api
. Adding new parameter to the method will break SPI clients of this class
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.
Changed. If you have a better name than processWithLockTarget
for the new method please tell me.
Old code "I" was not removed in initial commit for some reason.
…dia magento#1007 - Merge Pull Request magento-engcom/magento2ce#1007 from p-bystritsky/magento2:ISSUE-12378 - Merged commits: 1. 5c36f98 2. c27a56a
Added product codes to i18n
These codes have been renamed, so entries removed from i18n
- Merge Pull Request magento#12633 from miguelbalparda/magento2:image-fix - Merged commits: 1. ef1ffd5 2. cef5991
Added quotes around strings in i18n
…false</var> for mobile device don't work in product view page gallery magento#1006
Accepted Public Pull Requests: - magento#12736: Issues/12374 (by @virtual97) Fixed GitHub Issues: - magento#12374: Model hasDataChanges always true (reported by @Detzler) has been fixed in magento#12736 by @virtual97 in 2.2-develop branch Related commits: 1. a847d89 2. ae62931
concerns addressed in last commit
@avstudnitz Thanks for addressing @okorshenko's feedback. Would you mind taking a look at the mentioned merge conflict as well. |
This is similar to the "lock" switch which writes configuration values to app/etc/env.php. The "share" switch writes it to app/etc/config.php instead which can be shared between environments.
…hare option We are using Virtual Classes now as we have almost the same Processor twice and we can avoid having duplicate code this way.
The "getOption" method was called more often than before, so we had to adjust that.
This new method contains the new parameter and will be called from the old method.
…g-set-option-share # Conflicts: # app/code/Magento/Deploy/Model/Mode.php
|
@fooman I resolved the merge conflict and rebased the branch. Seems that has some side effects, tell me if I should create a new clean pull request. |
Hi @avstudnitz |
Continued in #13280. |
This is similar to the "lock" switch which writes configuration
values to app/etc/env.php. The "lock-config" switch writes it to
app/etc/config.php instead which can be shared between environments.
For consistency, the "lock" switch has been renamed to "lock-env".
Description
In most cases, configuration settings should be shared among all development, staging and live instances of a shop. To achieve this, you can use the same mechanism as with the
--lock
switch described in http://devdocs.magento.com/guides/v2.2/config-guide/cli/config-cli-subcommands-config-mgmt-set.html.The only difference is that the configuration values will be stored in app/etc/config.php instead of app/etc/env.php. This file should usually be included in the VCS and thus shared between instances.
To store a config setting in the file via command line, the command would be as follows:
i.e.
Manual testing scenarios
bin/magento config:set --lock-config general/store_information/name "Sample Store"
from the command lineContribution checklist