skip known procedural hooks for BC layer
Open
requested to merge issue/drupal-3493043:3493043-explore-inverting-checkforproceduralonlyhooks into 11.x
1 unresolved thread
Closes #3493043
Merge request reports
Activity
added 708 commits
-
6dd28dcd...09633691 - 706 commits from branch
project:11.x
- 259ba3d5 - skip known procedural hooks for BC layer
- 99d3a760 - skip all hooks that end with update_N in the initial regex
-
6dd28dcd...09633691 - 706 commits from branch
368 368 static fn ($x) => preg_quote($x, '/'), 369 369 $modules_by_length, 370 370 )); 371 $module_preg = '/^(?<function>(?<module>' . $known_modules_pattern . ')_(?!update_\d)(?<hook>[a-zA-Z0-9_\x80-\xff]+$))/'; 371 $module_preg = '/^(?<function>(?<module>' . $known_modules_pattern . ')_(?!.+update_\d)(?<hook>[a-zA-Z0-9_\x80-\xff]+$))/'; Storing here for future reference:
$modules = ['redirect_404', 'redirect']; $modules_by_length = $modules; usort($modules_by_length, static fn ($a, $b) => strlen($b) - strlen($a)); $known_modules_pattern = implode('|', array_map( static fn ($x) => preg_quote($x, '/'), $modules_by_length, )); $module_preg = '/^(?<function>(?<module>' . $known_modules_pattern . ')_(?<hook>[a-zA-Z0-9_\x80-\xff]+$))(?<!update_\d)(?<!update_\d\d)(?<!update_\d\d\d)(?<!update_\d\d\d\d)/'; print $module_preg; preg_match($module_preg, 'redirect_404_update_8101', $matches); preg_match($module_preg, 'redirect_404_cron', $matches); var_dump($matches);
Had a discussion with @GhostOfDrupalPast about this and he thinks this is the correct way to fix the concern here: https://3v4l.org/Nh9IQ
Please register or sign in to reply