How to apply a patch to a drupal Module from Windows
By Koder at Fri, 01/09/2009 - 14:25
I recently had to patch my Mollom Module that I have got installed on a Drupal installation. I just wanted to share with other folks as to how you can do this, especially from a Windows machine when you do not have access to a Linux or Unix command prompt to make changes or you do not have access to the patch utility.
|In our example below we would try to patch the Mollom module with a patch that is avaialable at http://drupal.org/node/302941 . All this patch does is modify the module file to make it aware of the Guestbook form, so Mollom can spam protect your site's Guestbook as well.
Here are the steps:
- Download the "Patch" utility for Windows from Sourceforge at http://gnuwin32.sourceforge.net/packages/patch.htm
- Run setup.exe and choose all defaults, this would create a C:\Program Files\GnuWin32\bin folder on your machine and a start menu entry as well.
- Connect to your Drupal website using an FTP client, and naviagate to your Mollom module directory (this is usually /sites/all/modules/mollom directory
- From your Mollom module directory above, download the "mollom.module" file to your C:\Program Files\GnuWin32\bin directory
- Download the Mollom Patch from http://drupal.org/node/302941 also to the C:\Program Files\GnuWin32\bin folder
- Open up a Windows command prompt (by clicking Start -> run -> cmd and hit enter)
- Change your directory to the GNU Patch program directory on the command prompt by giving the command cd C:\Program Files\GnuWin32\bin
- Patch the Mollom.module file locally by typing "patch < NameOfThePatchFileYouDownloaded" without quotes
- It would confirm that the file has been patched succesfully, and would also create a backup copy of the file with a file extension of .orig
- Finally, Upload this patched mollom.module file to your web server to the /sites/all/modules/mollom directory, overwtiting the the file that exsists there. For backup purposes, also upload the .orig file that the patch process created.
Mollom should now be patched.
Although this example shows how the Mollom.module was patched, its the same process for patching any other drupal module files as well. The .patch file you download is actually a text file, if you read the file it would tell you exactly which file in your module directory is it patching and what it is doing! Good Luck!