Problem/Motivation

All core modules except Node have been converted, let's mark them as skippable.

This excludes test modules.

Would be great to do a before/after comparison of drush install to see if/how much memory and potentially time we save.

Steps to reproduce

N/A

Proposed resolution

Add the following container parameter

parameters:
  module_name.skip_procedural_hook_scan: true

Call out any unique modules:

  • Node
  • SDC (stub)
  • Comment missed preprocess
  • Media library missed preprocess
  • Views missed preprocess

Core modules

  • comment_preprocess_field
  • media_library_preprocess_views_view__media_library
  • views_preprocess_node
  • views_preprocess_comment

Test modules

  • twig_theme_test_preprocess_status_messages

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-3494908

Command icon 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

nicxvan created an issue. See original summary.

nicxvan’s picture

Issue summary: View changes

nicxvan’s picture

Title: [pp-1] Mark several more modules as converted » Mark several more modules as converted
Issue summary: View changes
nicxvan’s picture

dww’s picture

Status: Active » Needs review

Glad to see the rest of this committed. Thanks for opening this as a new issue.

smustgrave’s picture

Status: Needs review » Needs work

With last nights commits appears to need a rebase.

if you are another contributor eager to jump in, please allow the original poster @nicxvan at least 48 hours to respond to feedback first, so they have the opportunity to finish what they started!

nicxvan’s picture

Yeah I had left this in needs work because I knew this needed the test fixes in the other issue.

nicxvan’s picture

Issue summary: View changes
Status: Needs work » Needs review
dww’s picture

It's still 61 files +788 −683. Can/should we split this up further to be easier to review? Maybe media* and system their own issues, everything else in here? I think that'd get us closer to +/- 500 here.

nicxvan’s picture

Status: Needs review » Needs work

I'll split media and library and then system to their own

nicxvan’s picture

Issue summary: View changes
nicxvan’s picture

Issue summary: View changes
nicxvan’s picture

Issue summary: View changes
nicxvan’s picture

Status: Needs work » Needs review

Ok I split system and the media modules out, those two issues are ready for review too.

nicxvan’s picture

Issue summary: View changes
dww’s picture

Title: Mark several more modules as converted » Mark several more modules as hooks converted from procedural to OOP
smustgrave’s picture

Status: Needs review » Needs work

Can the IS be updated with exactly what's being achieved here? Example the child issues marked what modules are being converted so it was super clear.

Thanks.

nicxvan’s picture

Issue summary: View changes

I added a list of the modules that I updated to the IS. Did you want more detail such as which changes are for each module?

nicxvan’s picture

Status: Needs work » Needs review
ambot112’s picture

Thanks for your progress and effort @nicxvan for MR !10614. Looking forward for its release.

smustgrave’s picture

Did you want more detail such as which changes are for each module?

- no that's probably not needed, just needed a quick glance on what was done "several modules" was kinda vague.

Will try and find time this week to take a look, much larger then the others so takes a little longer.

nicxvan’s picture

Title: Mark several more modules as hooks converted from procedural to OOP » [pp-1] Mark several more modules as hooks converted from procedural to OOP
Status: Needs review » Postponed
larowlan’s picture

Title: [pp-1] Mark several more modules as hooks converted from procedural to OOP » Mark several more modules as hooks converted from procedural to OOP
Status: Postponed » Active

Blocker is in

nicxvan’s picture

Title: Mark several more modules as hooks converted from procedural to OOP » [meta] Mark several more modules as hooks converted from procedural to OOP
Issue summary: View changes

Let's convert this to a meta, We have to re-evaluate some modules after #3495943: Handle module preprocess functions as OOP hooks.

We can also do this in groups and stages, we pushed this through faster originally due to the massive memory leak.

nicxvan’s picture

Issue summary: View changes

Ok I did a full audit of core modules, I checked whether the services parameter was set, if there were hooks that hadn't been converted, preprocess, template_preprocess, .inc, files and helpers.

I think this round is focused on hooks, preprocess and template preprocess in most cases. I think we only tackle .inc if they are preprocess hooks in them.

I think we try to balance how many are in a given issue but we address organization and what we can in each.

nicxvan’s picture

Issue summary: View changes
nicxvan’s picture

Issue summary: View changes

It ends up being a lot of changes even for mostly converted modules.

I think we may need to restrict this to an issue per module, I think we also want to isolate theme, theme suggestion and preprocess functions that do not inject services from ones that do.

I'm mostly through bigpipe and block on the issue linked.
Could use a high level review.

berdir’s picture

We seem to have multiple overlapping (meta) issues now. The block issue is now essentially #3494908: Set skip procedural scanning for all modules in core and also does DI, regroups hooks and so on. And there's the template_preprocess meta issue.

I'm unsure what the best way to split these is. The way it's done for block now kind of means we could just inline the actual last step that this aims to do (add the flag to services.yml once ready) into the cleanup meta and close this. I think the performance gains for those last few remaining modules is minor to tiny and it's no longer a priority from a performance perspective.

That said, the cleanup is fairly low prio and I expect those issues to land only slowly as they are hard to review and get committed. IMHO it's more useful to make sure that we've converted all legacy hooks and also preprocess stuff, with the goal of being able to explicitly deprecate legacy hooks and preprocess stuff in 11.3 for D13. For preprocess, we could expand the scope of #3504381: [meta] Convert Template Preprocess hooks to OOP equivalent to not only cover template_preprocess but all preprocess in modules. And I'd probably approach the hooks similar to #3265945: Deprecate plugins using annotations and plugin types not supporting attributes. Figure out how exactly we want to deprecate legacy hooks, that will tell us which bits we missed, and then we can possibly have a single issue to convert those.

nicxvan’s picture

Yeah, as I was doing it I knew the scope was too large but I wanted to check for sure.

I think this one reverts back to the minimum needed to mark a module as converted worth two exceptions.
1 hook requirements are handled in the issues dedicated to those.
2 for smaller module's we include converting template preprocess.

Bigger modules like node, views, and system will need dedicated hook, proprietary and template issues.

nicxvan’s picture

Tests just started, but this should be our target I think: https://git.drupalcode.org/project/drupal/-/merge_requests/12022/diffs

If there is a module like block_content that only has template_preprocess we can take care of it in the template preprocess issue.

nicxvan’s picture

Title: [meta] Mark several more modules as hooks converted from procedural to OOP » Set skip procedural scanning for all modules in core
Issue summary: View changes

Since all of core (except node) is converted I'll retarget this just to set the container parameter.

nicxvan changed the visibility of the branch 3494908-pp-1-mark-several to hidden.

nicxvan changed the visibility of the branch 11.x to hidden.

nicxvan’s picture

Issue summary: View changes
nicxvan’s picture

Issue summary: View changes
nicxvan’s picture

Issue summary: View changes

nicxvan’s picture

Issue summary: View changes
nicxvan’s picture

Issue summary: View changes
nicxvan’s picture

Status: Active » Needs review

This is ready for review!

We missed 4 preprocess functions, I will create follow ups to convert them.

nicxvan’s picture

nicxvan’s picture

nicxvan’s picture

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new91 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

nicxvan’s picture

Status: Needs work » Needs review

Rebased

berdir’s picture

There are 17 #[ProceduralHookScanStop] usages in those modules still. It's a fairly trivial search & replace for the modules that are switched here, I think it might be easier to include it here instead of a new issue, I think that's closely related and not scope creep?

If I saw that correctly, it's just two modules for this issue, locale and update. there's 2 in media as well which has a separate issue and one in a test module that we'll keep.

nicxvan’s picture

Makes sense!

I've removed them here, let me do the same in the media module issue.

nicxvan’s picture

I removed the media module preprocess here too.

berdir’s picture

Status: Needs review » Reviewed & tested by the community

I was confused by comment #50 at first, I guess you meant that you removed the stop attribute, not preprocess.

I think we're good now here. This will help to speed up discovery a bit and reduce container size. And it will ensure that we won't be adding new hooks to those modules, because they will no longer work (Silently, without any notice, I'd prefer an explicit deprecation, but one step at a time).

catch’s picture

Status: Reviewed & tested by the community » Needs work

This looks good but needs a rebase.

nicxvan’s picture

Status: Needs work » Reviewed & tested by the community

I think this is good actually, I think that merge error is a bug.

I pulled it down and rebased and it shows clean. I also checked the actual MR and there are no conflicts shown.

If I am missing something please let me know.

  • catch committed f43bc9e5 on 11.x
    Issue #3494908 by nicxvan, smustgrave, berdir: Set skip procedural...
catch’s picture

Status: Reviewed & tested by the community » Fixed

All fine now, guess I could have tried /rebase myself.

Committed/pushed to 11.x, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

cilefen’s picture

nicxvan’s picture

Thanks!

This is because we set system to skip, but system has system_hook_info which needs to still execute.

#3540033: Do not skip scanning for procedural hooks in the system module