When hook_init is called, you are calling: $node = menu_get_object() which then can sometimes call whole menu_rebuild() process within menu_get_item(). On very large sites, this can be a heavy duty burden that really isn't necessary if you don't have head scripts.

I have places a check on hook_init && hook_page_alter to prevent it from going into the logix if there are no snippets.

CommentFileSizeAuthor
check-for-snippets.patch2.7 KBlabboy0276
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

labboy0276 created an issue. See original summary.

anybody’s picture

Status: Active » Needs work

This issue is still very relevant and should be merged into the 7.x-1.x version. I'll prepare a MR.

anybody’s picture

Priority: Normal » Major
Status: Needs work » Reviewed & tested by the community

Patch from #1 as MR. Changes are fine and this is still important, as described in the issue summary. Setting priority to Major for the performance reasons.

RTBC!

anybody’s picture

Title: Check for snippets before trying to render » Ensure snippets to be non-empty

FatherShawn made their first commit to this issue’s fork.

fathershawn’s picture

Status: Reviewed & tested by the community » Needs review

Sufficient changes were recently merged that a local rebase was required. This change looks pretty straightforward to me but please re-check.

anybody’s picture

Status: Needs review » Reviewed & tested by the community

Thank you, I was also just on the way for the rebase.
Changes are fine. The "new" array() => [] syntax might be dangerous for super old PHP versions, you decide. I'm fine with that.

anybody’s picture

Status: Reviewed & tested by the community » Needs work

To be 100% safe, I'll change the syntax to the old one and merge it then, ok?

fathershawn’s picture

Sounds good - my ide clearly just switched it - I had it set to php 7.1

anybody’s picture

Status: Needs work » Needs review
fathershawn’s picture

This looks good on a code level. Has anyone verified this change locally?

anybody’s picture

Status: Needs review » Reviewed & tested by the community

Yep, works fine!

  • Anybody committed 3ac9aa1e on 7.x-1.x authored by FatherShawn
    Issue #2925281 by Anybody, FatherShawn, labboy0276: Ensure snippets to...
anybody’s picture

Status: Reviewed & tested by the community » Fixed

Merged! Going to tag a release now.

Thank you!

Status: Fixed » Closed (fixed)

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