1. Drupal 7

Update Drupal 7 core using patch

As we know that there is no shortcut for the Drupal 7 Core update. We can achieve this by generating a patch and applying that.

First of all we need to create the patch. We’ll need to download the current Drupal Core package as well as the Target version of the Core Package. In our example we are going to the update Drupal 7 core from 7.77 to 7.78.

Drupal 7 patch

If you are on Windows we’ll to download the git bash to run the next command. To download and install the git bash click here.

Open the git bash console and navigate to the folder containing the two packages.

diff -Naur drupal-7.77 drupal-7.78 > drupal-7.77-to-drupal-7.78.patch

It will generate the patch file within the same folder where two packages are located.

Next we need to run the Drupal 7 patch

  • Login to the server using any scp client and transfer the patch file to the root directory or the Drupal Root
  • Login through the ssh client and navigate to the Drupal root
  • Install the patch command (if not already installed)
sudo apt-get install patch
  • Dry run and check for errors patch -p1 --dry-run < drupal-7.77-to-drupal-7.78.patch If it doesn’t return any error then you are ready to go. (If you are getting hunk failed or unsuccessful it means that you have some changes on the Core file. So before applying the patch you need to replace the modified file with the original file )
  • Now run the actual command patch -p1 < drupal-7.77-to-drupal-7.78.patch
  • Run the command to check any db updates drush updb
  • Run the command to clear the cache drush cc all

Please share you feedback.

Do you like shamim's articles? Follow on social!
Comments to: Update Drupal 7 core using patch

Your email address will not be published. Required fields are marked *

Attach images - Only PNG, JPG, JPEG and GIF are supported.