Apply patches
We strongly recommend that you test all patches in a staging/development environment before deploying to production. We also strongly recommend that you back up your data before applying a patch.
See the below instructions to learn how to apply a patch to the Connector on both Cloud and non-Cloud environments.
For information about installing or upgrading the Connector see the Install or upgrade the Connector topic.
Intended audience
The audience for this topic is anyone who wishes to patch their Connector for their Magento installation. You should be fairly technical, understand Git commands, and be able to navigate the Magento file system.
Prerequisites
To use OMS and the Connector with Magento v2.3, you must disable Multi-source Inventory (MSI).
Requirements
To get started installing or upgrading the Connector you must have a Connector installed in your non-Cloud or Cloud environment.
On non-Cloud environment
The below method illustrates one way to apply a Connector patch to a non-Cloud environment. Your installation and processes may vary.
To apply a patch to your Connector for your non-Cloud environment:
-
Upload the patch to the
Magento_root
directory using FTP, SFTP, SSH, or your normal transport method. -
Login to the server as the Magento admin user and verify the file is in the correct directory.
-
See which files will be changed by the patch:
git apply --stat patch_file_name.patch
-
Ensure the patch has no associated errors:
git apply --check patch_file_name.patch
-
Apply the patch:
git am --signoff < patch_file_name.patch
The command assumes the file to be patched is located relative to the patch file.
-
Additionally, you can manually see files updated by the patch, and check the state of the patch installation, via your CLI.
-
Refresh the cache in the Admin under System > Tools > Cache Management to reflect your changes.
Alternatively, the patch can be applied locally with the same command, then committed and pushed normally.
On Cloud environment
To apply a patch to your Connector for your Cloud environment:
- Pull the latest changes from GitHub for your target branch.
-
In the command line interface (CLI), add the patch file to the
m2-hotfixes
directory, which is in the root directory of your Cloud instance:git add m2-hotfixes/patch_file_name.patch
The command assumes the file to be patched is located relative to the patch file.
-
Commit your changes:
git commit -m "Your commit message"
-
Commit your work and push your changes (your patch):
git push remote_name local_branch_name:remote_branch_name
The patch will be applied during the Cloud update after your
git push
. See more about upgrading the Connector on a Cloud environment in our Install or upgrade the Connector topic. -
Check the state of the patch installation, and files updated by the patch, in one of three ways:
- In your CLI or in the Magento Cloud Admin panel.
- Use SSH access to your Cloud environment.
- View the
var/log/cloud.log
file and search for the latest deployment.