Problem/Motivation
Marked critical because oop hooks won't get picked up for modules marked as converted.
I added a note to the cr referencing this issue.
While working on #3491275: Mark fully converted core modules as converted to OOP hooks History has no procedural hooks.
Marking history as converted
parameters:
history.hooks_converted: true
This test fails: core/modules/history/tests/src/Kernel/Views/HistoryTimestampTest.php
We need to include .module and / inc files even if we do not scan them.
Apply this patch and run the test and it passes.
Steps to reproduce
.
Proposed resolution
Remove the directory check.
The change looks bigger than it is, it is just removing this:
// Check only hook classes.
if ($skip_procedural) {
$dir = $dir . '/src/Hook';
}
and the wrapping if
if (is_dir($dir)) {
Changing the directory breaks the iterator.
We didn't see this in the original issue because the original issue only used the container parameter in one module and that module did not have hook classes.
Remaining tasks
N/A
User interface changes
N/A
Introduced terminology
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
N/A
Issue fork drupal-3491386
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:
- 3491386-include-.module-files
changes, plain diff MR !10443
Comments
Comment #3
nicxvan commentedComment #4
nicxvan commentedComment #5
nicxvan commentedComment #6
nicxvan commentedComment #7
nicxvan commentedComment #8
nicxvan commentedThis might be a red herring.It was my local file cache.
Comment #9
nicxvan commentedComment #10
nicxvan commentedComment #11
nicxvan commentedComment #12
nicxvan commentedComment #13
nicxvan commentedComment #14
nicxvan commentedComment #15
nicxvan commentedComment #16
catchOof that was my suggestion in the other issue. Feels like it should be possible to make this work - if we only have OOP hooks, we should only have to scan the hooks directory, but probably means two complete logic branches not this quick (broken) fix.
Moving to RTBC, since this is a critical regression from the previous issue, I'll commit it later if no objections.
Comment #17
nicxvan commentedYes, we could make that work, but it definitely needs a follow up, we currently look at every single file in a module directory.
We could probably safely limit it to scan just the top level and /src/Hooks always whether you do procedural or not. That will reduce the number of iterations significantly too.
Comment #18
nicxvan commented#3491724: Limit iterator in HookCollectorPass
Comment #21
catchCommitted/pushed to 11.x and cherry-picked to 11.1.x, thanks!