Patching Magento 2
Using MDOQ it is now easy to safely apply and test patches for Magento 2. Simply spin up an instance on MDOQ and follow these instructions. (If you're not using MDOQ manage Magento hosting, then these steps are still applicable, but you will need to manage the creation/setup of a development environment and taking this work to production.)
Preparation - install the dependencies
On your MDOQ instance, click Support then enter the SSH Web Console and run these commands
composer require --update-no-dev zero1limited/magento2-patches composer require --update-no-dev cweagans/composer-patches:^1.6.5 php bin/magento module:enable Zero1_Patches
Install your patches
MDOQ manage our own extension which makes it easier than ever to apply patches for Magento.
composer update zero1limited/magento2-patches --no-dev php bin/magento patch:list
This will provide you a list of the available patches, hopefully the one you are after will already be available. The example below will install a known patch from Magento such as those available from Magento Downloads, Patches & Tools or Security Centre
php bin/magento patch:add --patch=Catalog_pagination_issue_on_Elasticsearch_6 composer install --no-dev
Now all you need to do is simply commit your composer changes (.json & .lock)
- Click Git - Git Push - Select only the composer.json, composer.lock & app/etc/config.php (if you also installed zero1limited/magento2-patches this time round) and click 'Commit & Push'
- Click Sync - Files - recreate the instance selecting only 'Code'
This will recreate your instance, re-run the composer install and apply the patches.
Check the patches are applying
In order to verify 100% that the patches have applied, you can check the log files in your instance. Please review the animation below which illustrates one patch applied successfully and one patch failing. If you get 'Could not apply patch!' you will need to escalate your issue to a developer.
You can fork our Repo and generate a pull request if you have any patches you would like to add to https://github.com/zero1limited/magento2-patches
If you did not receive any patch errors, you are ready to Deploy!