Hello Everyone, Welcome to my blog. First of all for those people who don’t know anything about me please check out this link for more information.
If you want to connect with me or want to discuss any specific topic, want to share your view or anything, please feel free to write a comment below or write me an email on my email id i.e email@example.com. I will definitely try to address all your queries. Let’s get started.
Today, I would like to discuss the Magento version and upgrade Magento using CLI i.e. through composer. So, we will see how we can upgrade Magento 2.3.4-p2 to 2.3.5-p1. A little background about the Magento version and the patches.
Magento is using semantic versioning for individual modules. The semantic version provides a set of rules to manage different dependencies (not literally it’s not a package management system, rather its a set of rules/protocols like PSR, etc.) and requirements that dictate how version numbers are assigned and incremented.
The Magento is using the version like
For example, in the Magento version 2.3.5-p1, 2 stands for Major release, 3 stands for a Minor release like features, etc. 5 stands for the patch, and p1 stands for a security patch. So, here we can say 2.3.5-p1 will contain the upgraded code for security or fixes for security flaws.
You can find out more about the Magento version in the official dev doc here.
Let’s start our upgrade process. Here, I am assuming that you are using an updated version of the composer. If not, update your composer using the following command.
If you want to know more about the composer command, please check out this link.
Our first step is to take a backup of your existing composer.json file. Execute the following command to take the backup.
cp composer.json composer.json.bak
Our next step is to remove sjparkinson/static-review and fabpot/php-cs-fixer because they are abandoned packages and no longer maintained. Execute the following command to remove these modules(if existed).
composer remove --dev sjparkinson/static-review fabpot/php-cs-fixer --no-update composer update
Then we need to upgrade the Magento version using the following command.
composer require magento/product-enterprise-edition=2.3.5 --no-update<br>composer update
Note: If you are on the lower versions of the Magento like 2.3.1 or 2.3.2 then please repeat step 3 again with your next version. For example, If you have 2.3.2 currently installed in your system then the command should look like.
composer require magento/product-enterprise-edition=2.3.3 --no-update composer update composer require magento/product-enterprise-edition=2.3.4 --no-update composer update composer require magento/product-enterprise-edition=2.3.4-p1 --no-update composer update composer require magento/product-enterprise-edition=2.3.4-p2 --no-update composer update
Now, once we have upgraded our Magento framework run the following command to upgrade your Magento(database, DI, etc.)
php bin/magento setup:upgrade php bin/magento setup:static-content:deploy -f php bin/magento cache:clean
If you are upgrading the Magento directly on the staging or the production server, it is recommended to enable maintenance mode. You can enable the maintenance mode using the following command.
php bin\magento maintenance:enable
Things to remember
- If you are facing a package dependency error on Magento 2.3.4 version take the backup of your vendor directory and remove/rename it from the root directory.
- You no need to use –no-update parameter, this parameter is used to disable the automatic update of the dependencies.
- If you are facing issues while updating any package like “repo is not accessible”. Please check your auth.json file from the Magento root directory for valid credentials.
Feel free to leave a comment below. Let me know what you think about this blog. Good bye for now and happy coding 🙂