Hướng dẫn Patch Drupal core không cần ending up core/core or core/b

Hướng dẫn Patch Drupal core không cần ending up core/core or core/b

If you've ever patched Drupal core with Composer you may have noticed patched files can sometimes end up in the wrong place like core/core or core/b. Thankfully there's a quick fix to ensure the files make it into the correct location.

When using cweagans/composer-patches it's easy to include patches in your composer.json

"patches": {
    "drupal/core": {
        "Introduce a batch builder class to make the batch API easier to use": "https://www.drupal.org/files/issues/2018-03-21/2401797-111.patch"
    }
}

However in certain situations patches will get applied incorrectly. This can happen when the patch is only adding new files (not altering existing files), like in the patch above. The result is the patched files end up in a subfolder core/core. If the patch is adding new files and editing existing files the new files will end up in core/b. This is because composer-patches cycle through the -p levels trying to apply them; 1, 0, 2, then 4.

Thankfully there is an easy fix!

"extra": {
   ...
   "patchLevel": {
       "drupal/core": "-p2"
    }
}

Setting the patch level to p2 ensures any patch for core will get applied correctly.

Note that until composer-patches has a 1.6.5 release, specifically this PR, you'll need to use the dev release like:

"require": {
    ...
    "cweagans/composer-patches": "1.x-dev"
}

The 2.x branch of composer-patches also includes this feature.

Big thanks to cweagans for this great tool and jhedstrom for helping to get this into the 1.x branch.

Bạn thấy bài viết này như thế nào?: 
No votes yet
Ảnh của Tommy Tran

Tommy owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy

Bình luận (0)

 

Add Comment

Filtered HTML

  • Các địa chỉ web và email sẽ tự động được chuyển sang dạng liên kết.
  • Các thẻ HTML được chấp nhận: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Tự động ngắt dòng và đoạn văn.

Plain text

  • No HTML tags allowed.
  • Các địa chỉ web và email sẽ tự động được chuyển sang dạng liên kết.
  • Tự động ngắt dòng và đoạn văn.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.

Tìm kiếm bất động sản

 

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
HP: tablet webOS sẽ trở lại vào năm 2013

HP: tablet webOS sẽ trở lại vào năm 2013

Giám đốc điều hành của HP Meg Whitman cuối cùng cũng chính thức cho công bố số phận của hệ điều hành webOS sau khi công ty công bố ngừng phát triển smartphone và tablet chạy nền tảng webOS trước đó.

dien thoai di dong

Sử dụng chung di động có thể lây lan bệnh truyền nhiễm

ĐTDĐ có lượng vi khuẩn lớn gấp 10 lần so với một chiếc toilet, vì vậy không có gì ngạc nhiên khi một người đàn ông Uganda đã chết vì nhiễm vi khuẩn Ebola sau khi ăn cắp một chiếc ĐTDĐ từ phòng cách li của bệnh viện tại địa phương nơi đã bùng phát dịch bệnh do khuẩn Ebola.

Hướng dẫn upgrading lên Drupal 8 - client bắt mắt

Hướng dẫn upgrading lên Drupal 8 - client bắt mắt

Having helped create the original Drupal 6 site for NAMA in 2008, it’s been a rewarding experience re-architecting it in Drupal 8 (beta).

Công ty diệt chuột T&C

 

Diet con trung