hook_requirements_alter() is not invoked on update

Created on 2 December 2022, about 2 years ago
Updated 10 December 2023, about 1 year ago

Problem/Motivation

hook_requirements_alter() has been introduced recently ( #309040: Add hook_requirements_alter() ). It's called when the status report page is built, but it's not called when the update script looks for requirements, despite hook_requirements() being called.
This seems wrong to me. If it's on purpose, it should at least be documented.

Steps to reproduce

Untested as I discovered the problem in the code by accident while debugging something else. But I guess the way to test is to add a hook_requirements_alter() implementation in a custom module which triggers a requirement error. The update process (/update.php, or drush updb) should fail because of this hook implementation.

Proposed resolution

Call \Drupal::moduleHandler()->alter('requirements', $requirements); just after $requirements = \Drupal::moduleHandler()->invokeAll('requirements', ['update']);.

Remaining tasks

Agree this is a bug, make a patch or merge request, maybe with unit tests?

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

No need.

🐛 Bug report
Status

Fixed

Version

10.2

Component
Database update 

Last updated 8 days ago

No maintainer
Created by

🇫🇷France GaëlG Lille, France

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024