11

A while back, I installed Magento 2 via the composer meta-package. This is also known as the integrator install.

This appears to have installed Magento CE 2.0.1. Is there a way to upgrade this version to the latest Magento CE 2.0.3? I realize I could update the composer.json so that the 2.0.1 here

"require": {
    "magento/product-community-edition": "2.0.1",

becomes

"require": {
    "magento/product-community-edition": "2.0.3",

However, that would miss files like

app/etc/NonComposerComponentRegistration.php 

As well as any updates to the composer.json file itself.

Is it possible to update a version of Magento 2 installed with the meta package? Or is this not the intent of the meta packages?

  • alankent.me/2016/03/31/… might have some useful information. I believe NonComposerComponentRegistration.php will be updated when you do the upgrade due to the magento installer plugin for Composer. If there is a new 'magento2-base' module, it will replace the files previously installed by the base module. Article recommends "use git" to preserve local changes. You can fine the default file github.com/magento/magento2/blob/develop/app/etc/…, which gets package into the "magento2-base" package. – Alan Kent Mar 31 '16 at 7:36
  • "I believe NonComposerComponentRegistration.php will be updated" that's a negative -- or, at least, in my specific instance moving from 2.0.1 to 2.0.3 the composer upgrade didn't install NonComposerComponentRegistration.php, and didn't update app/etc/di.xml. – Alan Storm Mar 31 '16 at 17:23
  • You can update the metapackage with System Upgrade or from the command line. Caveat at this moment we're replacing 2.0.3 with 2.0.4 and access to repo.magento.com is blocked. Wait for an announcement. Step 1, run composer require <string> <version> --noupdate (check the syntax). Step 2, run composer update. Step 3, run bin/magento setup:upgrade – Steve Johnson Mar 31 '16 at 22:35
  • @SteveJohnson How will this update files outside of vendor? – Alan Storm Mar 31 '16 at 22:49
3

I just adjusted my composer.json file to use 2.0.4 instead of 2.0.2 (by hand), and afterwards ran composer update and php bin/magento setup:upgrade. Worked flawless in here.

I believe the Magento Composer installer package handles the installation of files in the app/ etc. folders, which also updates stuff on upgrade. But, this last part is just assumption as I haven't had to debug it.

  • @alanstorm, Do either of these answers help? – Steve Johnson Apr 2 '16 at 14:13
  • @stefandoorn can you please open up the file app/etc/NonComposerComponentRegistration.php and confirm the year of the copyright – Kristof at Fooman Apr 3 '16 at 1:00
  • /** * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ – stefandoorn Apr 3 '16 at 16:42
  • @KristofatFooman See above. – stefandoorn Apr 3 '16 at 16:42
2

I can currently not test it, as the composer repository of connect is broken, but I hope it's still useful.

That's my composer.json of my own project https://github.com/Cotya/DashboardProject/blob/6ce3f307c53a3fb54c94d8a7bd70b306036da928/composer.json

I changed recently to "magento/product-community-edition": "^2.0" to actually be able to update with a simple composer update --with-dependencies magento/product-community-edition command. I always explicitly name what should be updated, to not mix it up with the other packages I require besides magento, but therefore I need the --with-dependencies argument.

A very important part of this workflow is to commit the composer.lock file after each (successfully tested) update. As you see the diff of the lock file is too big for GitHub, that's a result of all the dependency updates and the reason, why you should not mix up a magento update with an update of something else.

As you can see, I have defined the files for NonComposerComponentRegistration myself, you can have multiple of them. Downside of my approach is, that when changes in the project composer.json happen, you need to apply them manually.

As you asked about the updating of the NonComposerComponentRegistration file, there are still a "few" files, which get copied out of vendor into the target directory, that's why I named it explicitly build to not mix up own with generated/copied stuff.

Hope that helps, even if this is quite a unique setup of M2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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