-
-
Notifications
You must be signed in to change notification settings - Fork 436
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
Fixed configuration name typo #3721
Conversation
Thank you for your PR. It is a harmless typo in my opinion and maybe it should be left like that. In a new installation the modification is fine, but in an existing one if this PR is adopted there must be two values in the configuration and not just one. This is because if any other extension uses that initial value, by deleting it using un upgrade script of the database, it will no longer work. I don't know how many extensions or custom code use this configuration value. If this PR is merged then a script to upgrade the record into the database must be implemented. |
Yes. Standard and automatic (no user commands required) way of updating values like this in M1 is to:
However this does not solve the problem of other modules depending on the old value name but I think that is normal part of version upgrades. Regarding this specific case I hardly believe any module is extending the "New Admin User Create Notification" true/false value. |
I bumped the version added the setup script. How does it look? I have another PR related to this I will be soon pushing. |
I don't have any custom modification that depends on that value, but it is only one opinion so far. I didn't test the update script but I looked over the code and it should make the change. |
Nice! My tests successfully upgraded the path in db. Here is the feature request I mentioned, it currently implements changes from this PR: #3722 |
Mmmm, it will break extions that use that config path. |
IMHO we should implement this change (probably nobody implemented something based on this config path) but in the |
I would approve as it is. I doubt that there is any extension that uses that path. It doesn't matter if it is main or next branch, if someone uses a production database, there will be both values available. |
app/code/core/Mage/Core/sql/core_setup/upgrade-1.6.0.10-1.6.0.11.php
Outdated
Show resolved
Hide resolved
oki, I'm willing to approve it as it is on the main branch, although I think we should be a bit stricter with the breaking-changes and technically this one is. If we'd be a bit stricter it would be actually more correct and we'd have a bigger changelog for the v21 which would also make it more clear that we need to release it ;-) |
$table = $installer->getTable('core/config_data'); | ||
|
||
if ($installer->getConnection()->isTableExists($table)) { | ||
$oldPath = 'admin/security/crate_admin_user_notification'; | ||
$newPath = 'admin/security/create_admin_user_notification'; | ||
|
||
$select = $installer->getConnection()->select() | ||
->from($table, ['config_id', 'path']) | ||
->where('path = ?', $oldPath); | ||
|
||
$rows = $installer->getConnection()->fetchAll($select); | ||
|
||
foreach ($rows as $row) { | ||
$installer->getConnection()->update( | ||
$table, | ||
['path' => $newPath], | ||
['config_id = ?' => $row['config_id']] | ||
); | ||
} | ||
} |
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.
$table = $installer->getTable('core/config_data'); | |
if ($installer->getConnection()->isTableExists($table)) { | |
$oldPath = 'admin/security/crate_admin_user_notification'; | |
$newPath = 'admin/security/create_admin_user_notification'; | |
$select = $installer->getConnection()->select() | |
->from($table, ['config_id', 'path']) | |
->where('path = ?', $oldPath); | |
$rows = $installer->getConnection()->fetchAll($select); | |
foreach ($rows as $row) { | |
$installer->getConnection()->update( | |
$table, | |
['path' => $newPath], | |
['config_id = ?' => $row['config_id']] | |
); | |
} | |
} | |
$installer->getConnection()->update( | |
$installer->getTable('core/config_data'), | |
['path' => 'admin/security/create_admin_user_notification'], | |
['path = ?' => 'admin/security/crate_admin_user_notification'] | |
); |
it seems easier than selecting then cycling no?
I've tested out both and I can confirm they work
Leave typos alone. We open a unnecessary hell-hole here. |
so, we've 2 negative vote, I'm kinda neutral and probably @addison74 too, we've to decide something |
I would not analyze this case in the general way, "not fixing typos". If we do this it means that we set up a rule for the OpenMage code. I consider this PR to be fine as long as the initial value is corrected by changing it. Although in such cases there are people who claim that BC could occur, for this PR no one came with a proof. I am for approval, in the form proposed by @fballiano, skipping the loop. |
No one came with proof because the core itself or known 3rd party code doesnt use it. That doesnt make this argument invalid. |
I see both of the arguments but I also think we should at a few things
|
I think it is still worth discussing. I'd like to propose that we do not fix typo if it is not backward compatible. Another example, if we correct the typo thinking that no one would use it: "tempate_filter" to "template_filter", it will break my projects and I would have no idea why things don't work anymore. |
It is obvious that no one can prove that changing such a word mistake in the code will create a BC. In this case, if the change is still requested, it would be natural to anticipate a possible error through a message. In this way, the developer will quickly identify the problem and adapt his code immediately. |
ok it's really not worth fighting over a typo, what @kiatng said makes a lot of sense, it's not worth a BC for a typo, whatever small or big the BC is. We should have an RFC to decide how to handle these things. For the time being I'll close this PR. |
Description (*)
This PR fixes a typo in a configuration name in the system XML. The incorrect configuration name
crate_admin_user_notification
has been corrected tocreate_admin_user_notification
.Related Pull Requests
#3722
Fixed Issues (if relevant)
No.
Manual testing scenarios (*)
create_admin_user_notification
.Questions or comments
As part of this change, I would like to discuss on how to handle the transfer of the existing configuration values when users upgrade to the new version. The goal is to migrate the values from the old configuration name (crate_admin_user_notification) to the new one (create_admin_user_notification) seamlessly during the upgrade process.
We could do core_setup script that copies the value but that would need that we upgrade the module version that has not been done before. Any insights or recommended approaches for this would be greatly appreciated.
Contribution checklist (*)