From 5c7983c4deae55ad41b85ca99db54d3fce283fd9 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Thu, 16 Sep 2004 07:17:56 +0000 Subject: - Patch #8179 by JonBob: reintroduced menu caching. --- modules/statistics/statistics.module | 62 +++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 29 deletions(-) (limited to 'modules/statistics/statistics.module') diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index 10029d9d3..4df088ed2 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -153,36 +153,40 @@ function statistics_link($type, $node = 0, $main = 0) { /** * Implementation of hook_menu(). */ -function statistics_menu() { +function statistics_menu($may_cache) { $items = array(); - $items[] = array('path' => 'statistics', 'title' => t('most popular content'), - 'callback' => 'statistics_page', - 'access' => user_access('access content'), - 'type' => MENU_SUGGESTED_ITEM); - - $access = user_access('administer statistics module') || user_access('administer statistics'); - $items[] = array('path' => 'admin/logs/hits', 'title' => t('hits'), - 'callback' => 'statistics_admin_displaylog', 'access' => $access, - 'weight' => 3); - $items[] = array('path' => 'admin/logs/hits/posts', 'title' => t('posts'), - 'callback' => 'statistics_admin_content', 'access' => $access, - 'weight' => 1); - $items[] = array('path' => 'admin/logs/hits/pages', 'title' => t('pages'), - 'callback' => 'statistics_top_titles', 'access' => $access, - 'weight' => 1); - $items[] = array('path' => 'admin/logs/hits/users', 'title' => t('users'), - 'callback' => 'statistics_top_users', 'access' => $access, - 'weight' => 2); - $items[] = array('path' => 'admin/logs/hits/hostnames', - 'title' => t('hostnames'), 'callback' => 'statistics_top_hostnames', - 'access' => $access, 'weight' => 3); - $items[] = array('path' => 'admin/logs/referrers', - 'title' => t('referrers'), 'callback' => 'statistics_top_referrers', - 'access' => $access, 'weight' => 4); - $items[] = array('path' => 'admin/logs/referrers/internal', - 'title' => t('internal'), 'access' => $access); - $items[] = array('path' => 'admin/logs/referrers/external', - 'title' => t('external'), 'access' => $access); + + if ($may_cache) { + $items[] = array('path' => 'statistics', 'title' => t('most popular content'), + 'callback' => 'statistics_page', + 'access' => user_access('access content'), + 'type' => MENU_SUGGESTED_ITEM); + + $access = user_access('administer statistics module') || user_access('administer statistics'); + $items[] = array('path' => 'admin/logs/hits', 'title' => t('hits'), + 'callback' => 'statistics_admin_displaylog', 'access' => $access, + 'weight' => 3); + $items[] = array('path' => 'admin/logs/hits/posts', 'title' => t('posts'), + 'callback' => 'statistics_admin_content', 'access' => $access, + 'weight' => 1); + $items[] = array('path' => 'admin/logs/hits/pages', 'title' => t('pages'), + 'callback' => 'statistics_top_titles', 'access' => $access, + 'weight' => 1); + $items[] = array('path' => 'admin/logs/hits/users', 'title' => t('users'), + 'callback' => 'statistics_top_users', 'access' => $access, + 'weight' => 2); + $items[] = array('path' => 'admin/logs/hits/hostnames', + 'title' => t('hostnames'), 'callback' => 'statistics_top_hostnames', + 'access' => $access, 'weight' => 3); + $items[] = array('path' => 'admin/logs/referrers', + 'title' => t('referrers'), 'callback' => 'statistics_top_referrers', + 'access' => $access, 'weight' => 4); + $items[] = array('path' => 'admin/logs/referrers/internal', + 'title' => t('internal'), 'access' => $access); + $items[] = array('path' => 'admin/logs/referrers/external', + 'title' => t('external'), 'access' => $access); + } + return $items; } -- cgit v1.2.3