From 49d97c48adda14a2f1eb2b3eed508481b6cb0a59 Mon Sep 17 00:00:00 2001 From: kurund Date: Wed, 15 Oct 2014 02:44:36 +0530 Subject: [PATCH] CRM-15436, because of caching of xml items, xml menu items defined by extension are not resolved during 'download and install' process, hence force computing menu items from xml during hard reset, i.e when we truncate civicrm_menu --- CRM/Core/Menu.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/CRM/Core/Menu.php b/CRM/Core/Menu.php index 75d0516a2c..e548e2cf65 100644 --- a/CRM/Core/Menu.php +++ b/CRM/Core/Menu.php @@ -69,10 +69,14 @@ class CRM_Core_Menu { CONST MENU_ITEM = 1; /** + * This function fetches the menu items from xml and xmlMenu hooks + * + * @param boolen $fetchFromXML fetch the menu items from xml and not from cache + * * @return array */ - static function &xmlItems() { - if (!self::$_items) { + static function &xmlItems($fetchFromXML = FALSE) { + if (!self::$_items || $fetchFromXML) { $config = CRM_Core_Config::singleton(); // We needs this until Core becomes a component @@ -158,11 +162,13 @@ class CRM_Core_Menu { /** * This function defines information for various menu items * + * @param boolen $fetchFromXML fetch the menu items from xml and not from cache + * * @static * @access public */ - static function &items() { - return self::xmlItems(); + static function &items($fetchFromXML = FALSE) { + return self::xmlItems($fetchFromXML); } /** @@ -255,6 +261,7 @@ class CRM_Core_Menu { } /** + * This function recomputes menu from xml and populates civicrm_menu * @param bool $truncate */ static function store($truncate = TRUE) { @@ -263,7 +270,7 @@ class CRM_Core_Menu { $query = 'TRUNCATE civicrm_menu'; CRM_Core_DAO::executeQuery($query); } - $menuArray = self::items(); + $menuArray = self::items($truncate); self::build($menuArray); -- 2.25.1