? 968826-features-menu-uuid.patch
? features-menu-updated.patch
? features.860974.patch
? uuid_features-menu_links-968826.patch
Index: includes/features.menu.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/features/includes/features.menu.inc,v
retrieving revision 1.1.2.13
diff -u -p -r1.1.2.13 features.menu.inc
--- includes/features.menu.inc	12 Aug 2010 19:30:35 -0000	1.1.2.13
+++ includes/features.menu.inc	24 Dec 2010 01:26:29 -0000
@@ -146,7 +146,16 @@ function menu_links_features_export_opti
  * Callback for generating the menu link exportable identifier.
  */
 function menu_links_features_identifier($link) {
-  return isset($link['menu_name'], $link['link_path']) ? "{$link['menu_name']}:{$link['link_path']}" : FALSE;
+  // Look up the node, if it has a uuid, we need to use that instead
+  $path = explode('/',$link['link_path']);
+  if($node = node_load(array('nid' => $path[1]))) {
+    $link['uuid'] = $node->uuid;
+  }
+  if(!empty($link['uuid'])) {
+    return isset($link['menu_name'], $link['uuid']) ? "{$link['menu_name']}:{$link['uuid']}" : FALSE;
+  } else {
+    return isset($link['menu_name'], $link['link_path']) ? "{$link['menu_name']}:{$link['link_path']}" : FALSE;
+  }
 }
 
 /**
@@ -195,10 +204,25 @@ function menu_links_features_export_rend
       // Replace plid with a parent path.
       if (!empty($link['plid']) && $parent = menu_link_load($link['plid'])) {
         $link['parent_path'] = $parent['link_path'];
+        // Check for uuid 
+        $parent_path = explode('/',$parent['link_path']);
+
+        if($parent_node = node_load(array('nid' => $parent_path[1]))) {
+          $link['parent_uuid'] = $parent_node->uuid;
+        }
       }
       unset($link['plid']);
       unset($link['mlid']);
 
+      // Load the uuid
+      $path = explode('/',$link['link_path']);
+
+      if($node = node_load(array('nid' => $path[1]))) {
+        $link['uuid'] = $node->uuid;
+        // Otherwise it will always be overridden
+        unset($link['link_path']);
+      }
+
       $code[] = "  // Exported menu link: {$identifier}";
       $code[] = "  \$menu_links['{$identifier}'] = ". features_var_export($link, '  ') .";";
       $translatables[] = $link['link_title'];
@@ -239,13 +263,18 @@ function menu_links_features_rebuild_ord
   if (!isset($ordered) || $reset) {
     $ordered = array();
     $unordered = features_get_default('menu_links');
-
     // Order all links by depth.
     if ($unordered) {
       do {
         $current = count($unordered);
         foreach ($unordered as $key => $link) {
-          $identifier = menu_links_features_identifier($link);
+          // This doesn't make sense just use the key?
+          // $identifier = menu_links_features_identifier($link);
+          $identifier = $key;
+          // Set the uuid system name if the parent_uuid exists
+          if($link['parent_uuid'] && $parent_node = node_get_by_uuid($link['parent_uuid'])) {
+            $link['parent_path'] = $link['parent_uuid'];
+          }
           $parent = isset($link['parent_path']) ? "{$link['menu_name']}:{$link['parent_path']}" : '';
           if (empty($parent)) {
             $ordered[$identifier] = 0;
@@ -262,18 +291,26 @@ function menu_links_features_rebuild_ord
     }
     asort($ordered);
   }
-
   // Ensure any default menu items that do not exist are created.
   foreach (array_keys($ordered) as $identifier) {
     $link = $all_links[$identifier];
     $existing = features_menu_link_load($identifier);
-    if (!$existing || in_array($link, $menu_links)) {
+    if (!$existing || !empty($menu_links[$identifier])) {
       // Retrieve the mlid if this is an existing item.
       if ($existing) {
         $link['mlid'] = $existing['mlid'];
       }
+      // Load the actual path based on the uuid if it exists
+      if($link['uuid'] && $node = node_get_by_uuid($link['uuid'])) {
+        $link['link_path'] = 'node/' . $node->nid;
+      }
       // Retrieve the plid for a parent link.
-      if (!empty($link['parent_path']) && $parent = features_menu_link_load("{$link['menu_name']}:{$link['parent_path']}")) {
+      if (!empty($link['parent_path'])) {
+        // Load the actual path based on the uuid if it exists
+        if($link['parent_uuid'] && $parent_node = node_get_by_uuid($link['parent_uuid'])) {
+          $link['parent_path'] = $link['parent_uuid'];
+        }
+        $parent = features_menu_link_load("{$link['menu_name']}:{$link['parent_path']}");    
         $link['plid'] = $parent['mlid'];
       }
       else {
@@ -289,6 +326,12 @@ function menu_links_features_rebuild_ord
  */
 function features_menu_link_load($identifier) {
   list($menu_name, $link_path) = explode(':', $identifier, 2);
+
+  // If $link_path is a valid uuid, set $link_path to the real node path
+  if (module_exists('uuid') && $node = node_get_by_uuid($link_path)) {
+    $link_path = 'node/' . $node->nid;
+  }
+
   $result = db_query("SELECT menu_name, mlid, plid, link_path, router_path, link_title, options, module, hidden, external, has_children, expanded, weight FROM {menu_links} WHERE menu_name = '%s' AND link_path = '%s'", $menu_name, $link_path);
   while ($link = db_fetch_array($result)) {
     $link['options'] = unserialize($link['options']);
