Easily Apply Drupal Patches with Patch Manager
Have you ever updated your Drupal site only to suddenly have errors?
If you use Drupal regularly, this will happen to you at some point. One common way to solve an error is with a patch. A patch changes the code on your site, but only by editing a file rather than providing a complete update.
However, applying a patch isn’t easy for non-coders. Many of the available instructions for applying patches ask you to use an application called Drush and to use command line instructions. These instructions can be intimidating, so we’re going to show you how non-coders can safely apply patches using the Patch Manager module.
- First, find the patch that you want to download. In this example, we’re going to use this patch for the Facetapi Slider module.
- Save the patch file to your desktop. In this example, I’ll save the file with the name “term_query_support-1347348-11.patch”
- Install and enable the Patch Manager module.
- Go to Structure > Patches.
- Click the “Add” tab.
- Patch name: Enter a name for this patch
- Patch file: Upload the file you just downloaded
- Module: Enter the system name of the module you’re applying the patch to. One easy way to get the name is from the URL of the module’s Drupal.org page. So the system name for the module is facetapi_slider because the project is hosted at https://www.drupal.org/project/facetapi_slider
- Click the Save button.
You’ll see that the patch has been saved, just like a content item:
Go to Structure > Patches and we can now apply the patch:
- Select the patch you just uploaded.
- Select “Apply patch” from the dropdown menu.
- Click the “Execute” button.
Congratulations, the patch has now been applied. If something goes wrong, you can always revert the patch to undo your changes:
If you are already using drush, [url=https://bitbucket.org/davereid/drush-patchfile]https://bitbucket.org/daver…[/url] might be a better solution than mixing code with content in the CMS.
+1 drush patchfile is a great tool to manage patches.
This is great. No idea why I had not heard about patch manager. On the d.o. support forums we still get non-developers who have never heard of drush or used command line, for whom this is especially useful to recommend
Thanks John. Yes, well said – there’s a lot of people out there in that situation.
Another good solution is to manage your codebase with drush make, which makes applying or removing patches a simple affair.
Yes, in an ideal world, Drush make is the best option: [url=https://www.drupal.org/project/drush_make]https://www.drupal.org/proj…[/url]
This tutorial for all those people stuck using Drupal sites without the ability to use the command line.
Nice module ! Great to show on how to patch via Drush also since there’s video on Drush here.
Thanks Simon, yes, for people who do want to use Drush to do this instead, we do have a full video course: [url=https://www.ostraining.com/courses/class/drupal/drush/]https://www.ostraining.com/…[/url]
I guess the reason it hasn’t been greatly adopted is because you have to make the effort to change file permissions manually on each file to use it, so it really doesn’t make anything easier, just creates an itemized list and maybe a little extra work.
Amazing the amount of people suggesting drush when you clearly state that this is for people who dont know how to use drush. As a non-Drush user, thanks for the tips – you also have to modify the permissions also to apply the patch?
LOL, you’re exactly right. When we write Drupal posts, we always get the same comments:
“Why not just use the command line?”
“Why not just write a custom module?”
Well, there’s 100,000’s of people using Drupal who just don’t have those skills … And, do we want Drupal to only be a tool for $150 per hour professionals?
I want to tell you that you just saved me tons of time following this tutorial, i used to apply patches manually by using simply notepad++
Using patch manager is a time saver.
I have one question though, due to the scary warning available on the patch manager drupal page about not enabling this module on a production site for security reasons.
My question is after applying the patch, is it obligatory to uninstall the patch manager or is it enough to just disabling it but keep it installed on my website ?!
Thank for your reply,