Problem/Motivation
The module's hook_requirements() (in metadata_sanitizer.install) reports whether ExifTool is available on the Status report (/admin/reports/status). On Drupal 11.3+ this entry never appears, so site admins get no warning when ExifTool is missing/misconfigured.
Root cause: the function is annotated with #[\Drupal\Core\Hook\Attribute\LegacyRequirementsHook]. Per core's own docblock, that attribute prevents the procedural requirements hook from executing on 11.3.0+
Steps to reproduce
1. Install the module on Drupal 11.3+.
2. Go to Reports → Status report (/admin/reports/status).
3. Expected: an "ExifTool availability" row (OK if installed, Error if not).
4. Actual: no ExifTool row at all - even when ExifTool is missing.
Proposed resolution
Implement the modern hook and keep the legacy one for older cores, sharing one helper so there's a single ExifTool entry on every supported version (^10.3 || ^11):
- Add metadata_sanitizer_runtime_requirements(): array - invoked on 11.2/11.3+.
- Keep metadata_sanitizer_requirements($phase) with #[LegacyRequirementsHook] - runs on 10.3 / 11.0 / 11.1 (attribute unknown ⇒ it runs); suppressed on 11.3+.
- Both return the requirement under the same key (metadata_sanitizer_exiftool), so even if both fire on 11.2 they array_merge into a single entry - no duplicate.
While fixing this, the check can also be made accurate: the original hardcoded new Process(['exiftool', '-ver']), which relies on the web server PATH and ignores the module's configured executable_path (and the Runner's extra-dir resolution).
So a site with a custom path got a false "Not found." Recommend routing the check through the runner service (resolve the same executable used for sanitization) and reporting the resolved path + version.
Remaining tasks
- [ ] Add hook_runtime_requirements() + shared helper; keep the legacy hook for BC
- [ ] Functional test that loads /admin/reports/status and asserts the ExifTool row renders (regression guard, since direct function calls hide the bug)
- [ ] Confirm severity passes correctly: int REQUIREMENT_OK/REQUIREMENT_ERROR still work on 11.3 (core maps them to the RequirementSeverity enum) and are kept for 10.3 BC
User interface changes
API changes
Data model changes
Issue fork metadata_sanitizer-3593750
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
nicholassComment #5
zarabatana commentedMerged into
1.0.x.This adds
metadata_sanitizer_runtime_requirements()for Drupal 11.3+ while keeping the legacymetadata_sanitizer_requirements()path for older supported Drupal versions.The ExifTool status report check now also respects the configured
executable_path.Closing as fixed.
Comment #7
zarabatana commented