Застосувати патч для Drupal за допомогою Composer

Надіслав: devoleksiy , дата: 07.02.2021 - 13:46
Image
Застосувати патч для Drupal за допомогою Composer

Встановіть плагін cweagans/composer-patches за допомогою команди:

composer require cweagans/composer-patches

1. Відкрийте файл composer.json в корені сайту і додайте в секцію "extra" наступний код:

        "patches": {
          "drupal/core": {
            "Fixed amp bigpipe": "https://www.drupal.org/files/issues/2019-02-20/amp-bigpipe-2723627-25.patch"
          },
           "drupal/amp": {
            "Current versions do not work with drupal 9.1.0": "https://www.drupal.org/files/issues/2020-12-04/amp-crash_core_91-3186185-3.patch"
          }
        },

Якщо після вставленої вами секції "patches" є ще інші секції то після останньої фігурної душки потрібно встановити кому, якщо секція "patches" остання то видаліть кому .

Готовый зразок коду:

    "extra": {
        "drupal-scaffold": {
            "locations": {
                "web-root": "web/"
            }
        },
        "installer-paths": {
            "web/core": [
                "type:drupal-core"
            ],
            "web/libraries/{$name}": [
                "type:drupal-library"
            ],
            "web/modules/contrib/{$name}": [
                "type:drupal-module"
            ],
            "web/profiles/contrib/{$name}": [
                "type:drupal-profile"
            ],
            "web/themes/contrib/{$name}": [
                "type:drupal-theme"
            ],
            "drush/Commands/contrib/{$name}": [
                "type:drupal-drush"
            ],
            "web/modules/custom/{$name}": [
                "type:drupal-custom-module"
            ],
            "web/profiles/custom/{$name}": [
                "type:drupal-custom-profile"
            ],
            "web/themes/custom/{$name}": [
                "type:drupal-custom-theme"
            ]
        },
        "patches": {
          "drupal/amp": {
            "Fixed amp bigpipe": "https://www.drupal.org/files/issues/2019-02-20/amp-bigpipe-2723627-25.patch"
          },
           "drupal/amp": {
            "Current versions do not work with drupal 9.1.0": "https://www.drupal.org/files/issues/2020-12-04/amp-crash_core_91-3186185-3.patch"
          }
        },
        "drupal-core-project-message": {
            "include-keys": [
                "homepage",
                "support"
            ],
            "post-create-project-cmd-message": [
                "<bg=blue;fg=white>                                                         </>",
                "<bg=blue;fg=white>  Congratulations, you’ve installed the Drupal codebase  </>",
                "<bg=blue;fg=white>  from the drupal/recommended-project template!          </>",
                "<bg=blue;fg=white>                                                         </>",
                "",
                "<bg=yellow;fg=black>Next steps</>:",
                "  * Install the site: https://www.drupal.org/docs/8/install",
                "  * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
                "  * Get support: https://www.drupal.org/support",
                "  * Get involved with the Drupal community:",
                "      https://www.drupal.org/getting-involved",
                "  * Remove the plugin that prints this message:",
                "      composer remove drupal/core-project-message"
            ]
        }
    }

 

2. Запустіть команду composer install і патч застосується.

composer install

3. Зафіксуйте пачт командою composer update --lock

composer update --lock

Info:

Очистіть кеш, і перевірте чи усунуто помилку. 

Зразок:

"patches": {
   "drupal/module_name": {
      "<patch information>": "<patch file path>"
    }
}

 

Теґи