Here's the promised patch that moves callbacks and arguments to a separate data structure from the visible menu tree. As mentioned on drupal-devel, this change has little impact except to slightly improve code legibility and prepare the code base for future separation of these tasks, with an eye toward performance improvements of the menu system.

The patch also changes array_key_exists() to isset() in several places, which is reported to perform better.

CommentFileSizeAuthor
#2 menu_callbacks.diff10.96 KBRichard Archer
menu_21.patch10.23 KBjonbob

Comments

moshe weitzman’s picture

This is a useful first step towards breaking up hook_menu() and speeding up drupal (by avoiding building up the menu tree on every request).

Richard - please have a look when you get a chance.

Richard Archer’s picture

StatusFileSize
new10.96 KB

I have had a look at this patch and can't immediately see any problems with it.
I definitely like the separation of callbacks out of the items tree.

Here's a new version that applies cleanly against HEAD.

dries’s picture

Status: Needs review » Fixed

Committed to HEAD. Thanks.

Jaza’s picture

When I updated my CVS copy, and loaded the front page of my test site (set to 'node'), I received a 404. This was because Drupal was fetching the old, cached, site menu from the DB.

So, for anyone else that updates to latest HEAD and has 404 'page not found' problems: make sure you clear your menu cache! You can do this by: ensuring that menu_rebuild() gets called; ensuring that cache_clear_all() gets called; or simply emptying the cache table in your database manually.

Once the cache is refreshed, this patch seems to work fine. Nice work!

Anonymous’s picture

Status: Fixed » Closed (fixed)