From b7bfbb26b8422c87bb41cab211d818421c87a054 Mon Sep 17 00:00:00 2001 From: webchick <webchick@24967.no-reply.drupal.org> Date: Tue, 14 Feb 2012 13:28:33 -0500 Subject: [PATCH] Issue #1234830 by beejeebus, oriol_e9g, schildi: Fixed cache_menu(): huge table size. --- includes/menu.inc | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/includes/menu.inc b/includes/menu.inc index 25a87af120ab..52a33a5b04c3 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. -- GitLab