CRM-15436, because of caching of xml items, xml menu items defined by extension are...
authorkurund <kurund@civicrm.org>
Tue, 14 Oct 2014 21:14:36 +0000 (02:44 +0530)
committerkurund <kurund@civicrm.org>
Tue, 14 Oct 2014 21:14:36 +0000 (02:44 +0530)
CRM/Core/Menu.php

index 75d0516a2ce67c4f4406ccc00ffcff240d2adf0f..e548e2cf658a553d37b2da51e02e3f620ea50ae4 100644 (file)
@@ -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);