To get Flysystem S3 ready for Drupal 10, I needed to apply the latest patch to the contrib module - Flysystem S3 (https://www.drupal.org/project/flysystem_s3).
Rather than using the current RC (2.0.0-rc5) release, which was released 25 March 2022. Instead, I'll be using the dev release - 2.0.x-dev updated 14 Aug 2023.
The patch I'll be using is from the issues area - Automated Drupal 10 compatibility fixes... go to https://www.drupal.org/project/flysystem_s3/issues/3297257#comment-15218438
Download the patch and prepare to be applied via Composer JSON file.
How do you apply a patch?
Save the patch to your root directory. To keep the patches organised, I've create a directory named patches.
patches
- flysystem_s3-d10compatibility-3297257-15.patch
In the composer.json file, the extra area will be something similar to
"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"]
}
}
Beneath installer-path, add:
- composer-exit-on-patch-failure
- patchLevel
- patches
As an example:
"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"]
},
"composer-exit-on-patch-failure": true,
"patchLevel": {
"drupal/core": "-p2"
},
"patches": {
}
}
In patches, we need to point Flysystem S3 to the patch. Let Drupal know the module that will be patched - drupal/flysystem_s3. And the path/filename to the patch... patches/flysystem_s3-d10compatibility-3297257-15.patch. Putting this together and it will look like:
"drupal/flysystem_s3": {
"config import ids": "patches/flysystem_s3-d10compatibility-3297257-15.patch"
},
Using the parent extra as noted earlier, it's children now appears as
"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"]
},
"composer-exit-on-patch-failure": true,
"patchLevel": {
"drupal/core": "-p2"
},
"patches": {
"drupal/flysystem_s3": {
"config import ids": "patches/flysystem_s3-d10compatibility-3297257-15.patch"
}
}
}