How to apply patch in Drupal 9?

Member

by jennifer , in category: PHP , 2 years ago

How to apply patch in Drupal 9?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

Y

Member

by yorkiepup , 2 years ago

@jennifer To apply patches in Drupal, you need to install cweagans/composer-patches first by running the command below:


1
composer require cweagans/composer-patches


After that, update your compose.json file with the patch list: 

1
2
3
4
5
6
7
8
9
"extra": {
    "enable-patching": true,
    "patches": {
        "drupal/core": {
            "patch-1": "patch #1 details",
            "patch-2": "patch #2 details",
        }
    }
}


and then you can run composer install to apply patches in Drupal 9.

by noemi_sporer , a year ago

@jennifer 

To apply patch in Drupal 9, follow the steps given below:

  1. Locate the patch - Find the patch file you wish to apply and save it to your Drupal root directory.
  2. Check if patch is applicable - Before applying a patch, you must make sure that the patch is applicable to your version of Drupal and the module.
  3. Apply patch using command line - Open your command prompt or terminal and navigate to your Drupal root directory. Then type the following command and hit enter. patch -p1 < patch-name.patch
  4. Verify patch - After the patch has been applied successfully, double-check that everything is working as expected.


Note: Make sure to take a backup of your website files and database before applying any patches.