summaryrefslogtreecommitdiff
path: root/includes/menu.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-11-07 21:51:40 +0000
committerDries Buytaert <dries@buytaert.net>2010-11-07 21:51:40 +0000
commit9f64d0e46c09258ea561586a59e5e8b521452aa3 (patch)
treefa7e24a72b11510c8c61d26623ada9750f6b8c37 /includes/menu.inc
parent7537eec11ceb09fe6d84abbf7dfc9d9c3984fdca (diff)
downloadbrdo-9f64d0e46c09258ea561586a59e5e8b521452aa3.tar.gz
brdo-9f64d0e46c09258ea561586a59e5e8b521452aa3.tar.bz2
- Patch #964822 by pwolanin: small optimization for menu_get_item().
Diffstat (limited to 'includes/menu.inc')
-rw-r--r--includes/menu.inc4
1 files changed, 2 insertions, 2 deletions
diff --git a/includes/menu.inc b/includes/menu.inc
index 3eccdec1f..0eb6d6618 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -413,8 +413,6 @@ function menu_get_item($path = NULL, $router_item = NULL) {
}
if (!isset($router_items[$path])) {
$original_map = arg(NULL, $path);
- $parts = array_slice($original_map, 0, MENU_MAX_PARTS);
- $ancestors = menu_get_ancestors($parts);
// Since there is no limit to the length of $path, use a hash to keep it
// short yet unique.
@@ -423,6 +421,8 @@ function menu_get_item($path = NULL, $router_item = NULL) {
$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');
}