Easily Apply Drupal Patches with Patch Manager

ost blog drupal patch

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:

  1. Select the patch you just uploaded.
  2. Select “Apply patch” from the dropdown menu.
  3. 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:

Author

  • Steve Burge

    Steve is the founder of OSTraining. Originally from the UK, he now lives in Sarasota in the USA. Steve's work straddles the line between teaching and web development.

0 0 votes
Article Rating
Subscribe
Notify of
12 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Kevin Reynen
Kevin Reynen
8 years ago

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.

Lars
Lars
8 years ago
Reply to  Kevin Reynen

+1 drush patchfile is a great tool to manage patches.

John_B
John_B
8 years ago

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

steve
steve
8 years ago
Reply to  John_B

Thanks John. Yes, well said – there’s a lot of people out there in that situation.

Tanner Ferguson
Tanner Ferguson
8 years ago

Another good solution is to manage your codebase with drush make, which makes applying or removing patches a simple affair.

steve
steve
8 years ago

Hi Tanner
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.

SimonW
8 years ago

Nice module ! Great to show on how to patch via Drush also since there’s video on Drush here.

steve
steve
8 years ago
Reply to  Simon

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]

Dean Flory
Dean Flory
8 years ago

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.

Tayto
Tayto
7 years ago

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?

steve
steve
7 years ago
Reply to  Tayto

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?

Charbel El Azzi
Charbel El Azzi
6 years ago

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,

12
0
Would love your thoughts, please comment.x
()
x