-
Notifications
You must be signed in to change notification settings - Fork 9.4k
"composer install" overwrite customizations outside of vendor folder #6221
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
Comments
I suspect that this is a feature, not a bug. Are there particular files that you think should be not part of the Magento core? |
Duplicate for dev/tools/grunt/configs/themes.js file: #4697 For the pub/index.php file, this is very dangerous what you are asking. If Magento decides to update the index.php file in a new version, and you upgraded your project you would miss those updates on the index.php file. |
The "composer install" command is IMHO intended to restore the dependencies of the application, but not modify the application in any way. The fact that it modifies a file which may contain additional pre-initialization logic (it may not be the most beautiful way, but it can be the most efficient way) breaks the ability to distribute an application without including its dependencies. When talking about the "composer upgrade" command, especially when it updates the Magento base package, I agree with the argument above. |
Ok that probably makes sense. We currently have the same "problem" with the run('tools/composer.phar install --prefer-dist --no-dev')
run('git checkout pub/.htaccess') |
This is a duplicate of #4697 |
It's not duplicate for #4697, I'm talking about creating development environment (git clone and composer install after) but not about upgrade procedure. |
|
Thank you for your submission. We recently made some changes to the way we process GitHub submissions to more quickly identify and respond to core code issues. Feature Requests and Improvements should now be submitted to the new Magento 2 Feature Requests and Improvements forum (see details here). We are closing this GitHub ticket and have moved your request to the new forum. |
Wouldn't this be a bug in the |
Sorry guys but your comments are totally pathetic. |
@vesan-83: the bug around the file Regarding the @wpalmer: sometimes you want to include |
Yes, and for those cases where this is needed, you can force-add the file. But as a default, it would make sense to not have a file managed by two separate systems. It would make a lot more sense to need to explicitly specify "I want to do something odd" than to have the default behavior be odd. Of course, if you think it's normal enough to modify the file that it should not be ignored by default, then it probably shouldn't default to being modified by composer. One, or the other, might make sense, but the current situation doesn't (note that this applies to more than just index.php) |
I found this issue when I realised our deployment process is reverting my changes on index.php when it's running composer install. Please check the first 16 lines of this file:
It's suggesting to set these variables in index.php. I would remark that this was the common practice in Magento 1 as well and there's no any other easy way to do this (other than setting environmental variables in the webserver configuration). If this file is open to customisations, then a simple "composer install" should not overwrite it. Given the simplicity of this file, I would suggest do not change it upstream ever. Or if it's necessary, just alert the developers in the changelog to make those changes. |
@czettnersandor: I've been meaning to test the following, but haven't found the time yet: apparently you can define a php file in your |
There is a This sounds pretty dumb to me. How are we supposed to deploy the application with composer when running |
Since this thread was originally opened, the list of files which "composer install" overwrites has only gotten larger. Much larger. |
💩 |
For those being plagued by this issue, You can disable this feature by setting the following in the composer.json:
This will update the magento composer installer code to not copy everything over on install. |
That doesn't actually solve anything, because then *nothing* gets updated.
The problem is that files which should not be updated by the user, should
not be tracked by git. The fact that the files are automatically updated is
a good thing, and disabling this is dangerous / breaks basic assumptions
about what happens when you update 3rd-party libraries.
Files which should/might be updated, should be divided up in such a way
that the "vendor" and "user" sections are separated.
…On Wed, Sep 26, 2018, 19:19 RJ Garcia ***@***.***> wrote:
For those being plagued by this issue, You can disable this feature by
setting the following in the composer.json:
"extra": {
"magento-deploystrategy": "none"
}
This will update the magento composer installer code to not copy
everything over on install.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6221 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAVytJTrukomeyRhd_buUjnKNRGShb25ks5ufAt2gaJpZM4JnXH->
.
|
It depends on what you want. Personally, I prefer to install magento, then clean out all of the files not needed. Then on a magento version upgrade, just change that to If you want to just ignore a few files, that's possible too with |
If anyone came here because of deployer/capistrano overwritten your files, I'd recommend you try:
Reference: https://stackoverflow.com/a/51961956/2620326 |
[Sidecar] Fixes for 2.4 (pr3)
"composer install" command overwrite modifications in mapped files (files from composer.json -> extra.map node of magento/magento2-base module).
Preconditions
Magento 2.1.0
Steps to reproduce
Expected result
Actual result
The text was updated successfully, but these errors were encountered: