Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Title says it all. menu_rebuild() rebuilds the menu immediately. variable_set('menu_rebuild_needed', TRUE) schedules the rebuild for the next page load.
This means that even if you call menu rebuilding code 10 times, the variable_set way will ensure it's not rebuilt more than needed (which is once).
This improves install performance, where we frequently had menu rebuilds happening multiple times for no good reason.
Comment | File | Size | Author |
---|---|---|---|
#1 | 1574746-smarter-menu-rebuild.patch | 2.22 KB | bojanz |
Comments
Comment #1
bojanz CreditAttribution: bojanz commentedEasy enough.
Comment #2
rszrama CreditAttribution: rszrama commentedGreat, very nice.
Comment #4
AnybodyHas this ever been fixed / commited? Seems like "timed out" but is important for performance? (No commit visible)
Comment #5
rszrama CreditAttribution: rszrama at Centarro commentedYes, I wouldn't have marked it fixed otherwise. ^_^
(It just predates the time when d.o started tagging related issues with commit links; if you look in the code, you can see it's been committed.)
Comment #6
AnybodyThank you very much and sorry. My mistake.
Comment #7
rszrama CreditAttribution: rszrama at Centarro commentedNo worries - d.o didn't do any sort of retroactive notifications with the rollout. Would've been a good idea, tho. ^_^