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.
Issue fork drupal-3324995
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 #6
claudiu.cristeaComment #7
claudiu.cristeaAdded tests
Comment #8
gaëlgComment #9
alorencThanks, I am able to alter requirements when the update script is performed.
Comment #10
quietone commentedI'm triaging RTBC issues. I read the IS, the comments and skimmed the patch. I didn't find any unanswered questions or other work to do.
Leaving at RTBC.
Comment #11
alexpottCommitted and pushed 64e5e002c2 to 11.x and 5e3b8c6d71 to 10.2.x. Thanks!
Backported to 10.2.x as a low risk bug fix.