Skip to main content
Ungathered Thoughts

What patches are we running?

I'm at a code sprint with members of the Drupal community today, and we're looking for tasks to work on. The agency company I work for manages Drupal sites for a number of clients, and across those sites we might apply patches for the same issues to various projects.

Patches are applied using cweagans/composer-patches and defined per-project using an entry in a composer patches file.

By scanning these files and looking at the related issues, we can get a high-level view of the patches in play, and start to see some interesting things.

My goal for this is to build a Composer plugin (xurizaemon/patchwatch) which can be used as a command from the project's CI, but for today (and mostly due to network issues while travelling) I shot for a quick and dirty PHP script which gave me some serviceable output.

Here's some excerpted and redacted output, to show what we can see afterwards. This is a pretty crude PoC.

{
"drupal/core": {
"2825860": {
"label": "Notice: Undefined index: value in Drupal\\views\\Plugin\\views\\filter\\NumericFilter->acceptExposedInput()",
"status": "Needs work",
"https://www.drupal.org/files/issues/2023-02-07/2825860-129.patch": [
"project-1"
]
},
"3309831": {
"label": "Add base_table to entity query metadata",
"status": "Needs work",
"https://www.drupal.org/files/issues/2022-09-16/3309831-3.patch": [
"project-2"
]
},
"2868384": {
"label": "Can't login after upgrading from Drupal 7 to 8 due to stale cookies",
"status": "Needs work",
"https://www.drupal.org/files/issues/2022-05-27/2868384-54.patch": [
"project-2"
],
"https://www.drupal.org/files/issues/2019-03-20/2868384-35.patch": [
"project-1"
]
}
},
"drupal/contact_storage": {
"3191567": {
"label": "Notice: Undefined index: entity:delete_action:contact_message in contact_storage_action_info_alter()",
"status": "Reviewed & tested by the community",
"https://www.drupal.org/files/issues/2021-01-12/3191567-9.patch": [
"project-1"
],
"https://www.drupal.org/files/issues/2022-11-07/contact_storage-bc_action_fix-3191567-31.patch": [
"project-3"
]
},
"3053497": {
"label": "Error while field storage definition",
"status": "Reviewed & tested by the community",
"https://www.drupal.org/files/issues/2022-10-19/contact_storage.patch": [
"project-3"
]
}
},
"drupal/inline_entity_form": {
"2875716": {
"label": "Widget settings to control removing & deleting existing references",
"status": "Closed (fixed)",
"https://www.drupal.org/files/issues/2022-09-21/ief_removed_references_2875716-119.patch": [
"project-4"
]
},
"2822764": {
"label": "Support adding new entities when translating",
"status": "Needs work",
"patches/2822764-89.patch": [
"project-5"
]
}
},
"drupal/views_data_export": {
"2887450": {
"label": "Support views data export using drush",
"status": "Needs review",
"https://www.drupal.org/files/issues/2022-02-24/vde-drush-with-output-location-2887450.patch": [
"project-1"
]
},
"3173296": {
"label": "Batch mode does not allow other modules to alter query",
"status": "Needs review",
"https://www.drupal.org/files/issues/2021-02-12/3173296-9-batch-query-alter.patch": [
"project-1"
]
}
}
}

And here's the quick script, somewhat munged to hopefully share my rough initial script in a single executable .php. The repository for this project will be https://gitlab.com/xurizaemon/patchwatch

(I haven't embedded the output and script here because I apparently haven't sorted out code embeds on my own blog yet ... sorry!)

The interesting things we can start to see from the output above are:

Next steps are:

Something which might be interesting - if Drupal.org wanted to surface it - would be the download stats / popularity of patch URLs. This might indicate patches which are "popular" and being applied by lots of sites, and good candidates for review.

If this looks useful, or you know of a similar approach to this which I don't or are interested to explore further - get in touch! I'd love to hear from you.

Update: progress report here