diff options
author | webchick <webchick@24967.no-reply.drupal.org> | 2012-02-14 13:28:33 -0500 |
---|---|---|
committer | webchick <webchick@24967.no-reply.drupal.org> | 2012-02-14 13:28:33 -0500 |
commit | b7bfbb26b8422c87bb41cab211d818421c87a054 (patch) | |
tree | d07ad86fb341a37f2bd43600a674f22d21934888 /includes/menu.inc | |
parent | b70430c9d0a07d2e5c6b35f91ffe532148edbbe1 (diff) | |
download | brdo-b7bfbb26b8422c87bb41cab211d818421c87a054.tar.gz brdo-b7bfbb26b8422c87bb41cab211d818421c87a054.tar.bz2 |
Issue #1234830 by beejeebus, oriol_e9g, schildi: Fixed cache_menu(): huge table size.
Diffstat (limited to 'includes/menu.inc')
-rw-r--r-- | includes/menu.inc | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/includes/menu.inc b/includes/menu.inc index 25a87af12..52a33a5b0 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -452,18 +452,10 @@ function menu_get_item($path = NULL, $router_item = NULL) { } $original_map = arg(NULL, $path); - // Since there is no limit to the length of $path, use a hash to keep it - // short yet unique. - $cid = 'menu_item:' . hash('sha256', $path); - if ($cached = cache_get($cid, 'cache_menu')) { - $router_item = $cached->data; - } - else { - $parts = array_slice($original_map, 0, MENU_MAX_PARTS); - $ancestors = menu_get_ancestors($parts); - $router_item = db_query_range('SELECT * FROM {menu_router} WHERE path IN (:ancestors) ORDER BY fit DESC', 0, 1, array(':ancestors' => $ancestors))->fetchAssoc(); - cache_set($cid, $router_item, 'cache_menu'); - } + $parts = array_slice($original_map, 0, MENU_MAX_PARTS); + $ancestors = menu_get_ancestors($parts); + $router_item = db_query_range('SELECT * FROM {menu_router} WHERE path IN (:ancestors) ORDER BY fit DESC', 0, 1, array(':ancestors' => $ancestors))->fetchAssoc(); + if ($router_item) { // Allow modules to alter the router item before it is translated and // checked for access. |