Magento Tutorial-How to Apply a Patch

Last modified by Rhonda Rondeau on Wed, September 14, 2011 10:07
Source|Old Revisions  

This is an old revision of the document!


Sometimes Magento provides users with patches that fix certain issues and/or add some new functionality for previous versions.

Here is a brief tutorial on how you can install patches represented by .patch or .diff files. These files contain information about Magento files that should be changed/added and the lines of code that should be added to/removed from/changed in corresponding files.

Assume you are using Magento and you have already downloaded a .patch (.diff) file related to your version from www.magentocommerce.com (assume the patch is named 1420_patch.patch). In order to successfully install this patch you need to follow the next steps:

Step 1. Backup current state

On this step you need to backup your current Magento installation i.e. copy it from the server on your local drive or another folder on server. For example: Magento was installed into /upandrunning folder on the server.

We need to copy its content to another folder (for instance: /backup folder on the same server). You can use cp -r command to do it. For instance:

Step 2. Copy patch file into the backup folder

Step 3. Apply patch to the backup

On this step you need to patch your system and make sure that everything was fine. The command that will actually do all the work is: patch -p0 -i name_of_the_patch_file This command should be executed inside the target folder (/backup in our case). The result can look as following: If result shows conflicts or some of the target files were not successfully patched, it can mean that downloaded patch is related to another Magento version or you somehow changed the source code of corresponding files and it led to a conflict. *To revert the patch you can use the following command: patch -p0 -R -i name_of_the_patch_file

Step 4. Apply patch to the original Magento installation

If there were no conflicts on the step 3, you can now patch your original Magento installation. To do it, please make sure you have enough permissions to modify files in your Magento home directory (in our case it is /upandrunning folder) and perform actions described in Step 2 and Step 3 regarding it.

*At the end you should remove backup folder and the patch file from Magento home directory, because they are not needed anymore.




 

Magento 2 GitHub Repository

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs