summaryrefslogtreecommitdiff
path: root/includes/menu.inc
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2013-12-30 17:57:55 -0500
committerDavid Rothstein <drothstein@gmail.com>2013-12-30 17:57:55 -0500
commitaa6235c3c3fd08123d9d1d9eecb07a3e9b72b69f (patch)
treed0045ce81f9c19382802194e657056f302dec3ba /includes/menu.inc
parent67ad400f5def8ef2ed7742b729502b34997d12df (diff)
downloadbrdo-aa6235c3c3fd08123d9d1d9eecb07a3e9b72b69f.tar.gz
brdo-aa6235c3c3fd08123d9d1d9eecb07a3e9b72b69f.tar.bz2
Issue #805236 by merrillholt, ekl1773, marcingy, sun, catch: Cache the query in menu_local_tasks().
Diffstat (limited to 'includes/menu.inc')
-rw-r--r--includes/menu.inc22
1 files changed, 15 insertions, 7 deletions
diff --git a/includes/menu.inc b/includes/menu.inc
index a93ddad60..aef557a24 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -1926,13 +1926,21 @@ function menu_local_tasks($level = 0) {
}
// Get all tabs (also known as local tasks) and the root page.
- $result = db_select('menu_router', NULL, array('fetch' => PDO::FETCH_ASSOC))
- ->fields('menu_router')
- ->condition('tab_root', $router_item['tab_root'])
- ->condition('context', MENU_CONTEXT_INLINE, '<>')
- ->orderBy('weight')
- ->orderBy('title')
- ->execute();
+ $cid = 'local_tasks:' . $router_item['tab_root'];
+ if ($cache = cache_get($cid, 'cache_menu')) {
+ $result = $cache->data;
+ }
+ else {
+ $result = db_select('menu_router', NULL, array('fetch' => PDO::FETCH_ASSOC))
+ ->fields('menu_router')
+ ->condition('tab_root', $router_item['tab_root'])
+ ->condition('context', MENU_CONTEXT_INLINE, '<>')
+ ->orderBy('weight')
+ ->orderBy('title')
+ ->execute()
+ ->fetchAll();
+ cache_set($cid, $result, 'cache_menu');
+ }
$map = $router_item['original_map'];
$children = array();
$tasks = array();