6

I'm using Magento CE 2.1

There's a fix in the 2.2.x develop branch that looks likely not to be released until 2.2, so how do I pull it into my 2.1 installation?

What I have tried

As Magento 2 is split into modules pulled in by composer I would hope that I could just pull in an updated version of a module like module-deploy by using a version like 100.2.0-dev. I replaced using the monolithic magento/product-community-edition with the individual module requirements and changed the requested version of module-deploy. Sadly, the magento composer repo only has formal releases.

So the next thing would be to fork the module and pull in my own version for that module. However, Magento 2 seems to be a single repo, so what should I fork to just adjust a single module? Does this approach even make sense?

2 Answers 2

1

I don't see this as a being a good idea and would advise against it in any environment especially if this is a production website. The latest modules will have dependencies on other dev modules including the framework itself and depending on the amount of changed code probably would just not work.

That being said, my first thought would be to clone the Github repo, copy the existing module from the repo app/code/Magento/<module_name>, and replace the module in the vendor directory at <magento_root>/vendor/magento/<module_name> on your Magento server.

Also see this answer about using Github with composer.

1
  • I agree about the risks, but I take it you see the need to be able to update a single module? Sounds like you also think that there is no single repo per module, so there's no way to fork an existing repo as you essentially have to copy and paste the data from a single directory. That's what I feared. Commented Aug 22, 2016 at 11:40
2

UPDATE:

There is a way!!

There are two parts to this:

  1. Download a copy of the module at the version you want it directly into your code base. If it's a magento module you can just add it directly into app/code/Magento/...

  2. Add an entry into the replace section of composer.json which will tell composer "don't bother pulling in the needed dependency - I've got it locally". e.g. to replace magento/module-braintree, the composer.json section might look like this:

    "replace": { "magento/module-braintree": "*" }

This isn't perfect - it's a little hacky. But it's a way to make replacements when really needed. For example, Magento made a mistake with 2.1.8 which meant that credis needed to be at a higher version than specified in their meta-package. Using this approach I could force the correct version.

Original answer: I've reverted to making my own fixes in a Magetno2fix module locally with reference to the relevant tickets so that these can be removed on upgrade. Seems a shame that we can't more easily use the fine-grained modularisation for this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.