From 11cd3f91e1a6660d29026394b55d9116c889f0a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roger=20L=C3=B3pez?= <lopez.roger@gmail.com>
Date: Tue, 27 Jul 2010 14:42:19 +0000
Subject: [PATCH 1/8] feature #866118 by flobruit: Preserve term hierarchy

---
 includes/uuid_term.features.inc |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/includes/uuid_term.features.inc b/includes/uuid_term.features.inc
index 9b94f89..57b824e 100644
--- a/includes/uuid_term.features.inc
+++ b/includes/uuid_term.features.inc
@@ -45,6 +45,14 @@ function uuid_term_features_export($data, &$export, $module_name = '') {
 
     // Add the vocab UUID to the pipe, to be processed by uuid_vocabulary.
     $export['features']['uuid_vocabulary'][$voc_uuid] = $voc_uuid;
+    
+    // Get the UUID of the term's parents.
+    $tid = uuid_get_serial_id('term_data', 'tid', $uuid);
+    $parents = taxonomy_get_parents($tid);
+    foreach ($parents as $parent) {
+      $parent_uuid = uuid_get_uuid('term_data', 'tid', $parent->tid);
+      $export['features']['uuid_term'][$parent_uuid] = $parent_uuid;
+    }
   }
 
   return $pipe;
@@ -74,6 +82,12 @@ function uuid_term_features_export_render($module = 'foo', $data) {
         $export[$key] = $term->$key;
       }
     }
+    
+    // Get the UUID of the term's parent terms.
+    $parents = taxonomy_get_parents($tid);
+    foreach ($parents as $parent) {
+    	$export['parent'][] = uuid_get_uuid('term_data', 'tid', $parent->tid);
+    }
 
     // Get the UUID of the term's vocabulary.
     $query = 'SELECT uv.uuid FROM {uuid_vocabulary} uv WHERE uv.vid = "%s"';
@@ -117,6 +131,13 @@ function uuid_term_features_rebuild($module) {
       $vid = db_result(db_query('SELECT vid FROM {uuid_vocabulary} WHERE uuid = "%s"', $data['uuid_vocabulary']));
       if ($vid) {
         $data['vid'] = $vid;
+        
+        if (isset($data['parent']) && is_array($data['parent'])) {
+	        foreach ($data['parent'] as $key => $parent_uuid) {
+	          $data['parent'][$key] = uuid_get_serial_id('term_data', 'tid', $parent_uuid);
+	        }
+	      }
+
         $ret = taxonomy_save_term($data);
 
         // TODO: remove when http://drupal.org/node/860442 is resolved.
-- 
1.6.6.1


From ab917536a01a4f41f42243dd5073cc6600ac0466 Mon Sep 17 00:00:00 2001
From: Ezra Barnett Gildesgame <ezra-g@69959.no-reply.drupal.org>
Date: Thu, 23 Dec 2010 01:37:01 +0000
Subject: [PATCH 2/8] feature #920966 by DamienMcKenna: Add support for all  attributes

---
 includes/uuid_node.features.inc |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/includes/uuid_node.features.inc b/includes/uuid_node.features.inc
index d7a972b..32bf293 100644
--- a/includes/uuid_node.features.inc
+++ b/includes/uuid_node.features.inc
@@ -67,18 +67,14 @@ function uuid_node_features_export_render($module, $data) {
   $code[] = '';
   foreach ($data as $uuid) {
     $node = node_get_by_uuid($uuid);
-
-    $export = new stdClass();
-    $props = array('uuid', 'type', 'language', 'status', 'comment', 'promote', 'moderate', 'sticky',
-      'title', 'body', 'format', 'name', 'path', 'revision');
-    foreach ($props as $key) {
-      if (isset($node->$key)) {
-        $export->$key = $node->$key;
-      }
-    }
+    $export = $node;
 
     // Use date instead of created, in the same format used by node_object_prepare.
-    $export->date = format_date($node->created, 'custom', 'Y-m-d H:i:s O');
+    $export->date = format_date($export->created, 'custom', 'Y-m-d H:i:s O');
+    
+    // Don't cause conflicts with the legacy nid/vid fields.
+    unset($export->nid);
+    unset($export->vid);
 
     // The hook_alter signature is:
     // hook_uuid_node_features_export_render_alter(&$export, &$node, $module);
-- 
1.6.6.1


From cc091b5cc5f59ac9bd3915596692e8a58e68c6d7 Mon Sep 17 00:00:00 2001
From: Ezra Barnett Gildesgame <ezra-g@69959.no-reply.drupal.org>
Date: Thu, 23 Dec 2010 01:51:12 +0000
Subject: [PATCH 3/8] bug #924794 by DamienMcKenna: Errors if node fields are out of sync

---
 includes/modules/content.inc       |   16 ++++++++++------
 includes/modules/filefield.inc     |   21 +++++++++++++--------
 includes/modules/nodereference.inc |   21 +++++++++++++--------
 includes/modules/userreference.inc |   16 ++++++++++------
 4 files changed, 46 insertions(+), 28 deletions(-)

diff --git a/includes/modules/content.inc b/includes/modules/content.inc
index 12d978b..51f69cb 100644
--- a/includes/modules/content.inc
+++ b/includes/modules/content.inc
@@ -21,13 +21,17 @@ function content_uuid_node_features_export_render_alter(&$export, &$node, $modul
       $field_name = $field['field_name'];
       $export->$field_name = array();
 
-      // Loop through all values of the field.
-      foreach ($node->$field_name as $delta => $data) {
-        $export->{$field_name}[$delta] = array();
+      // If the content type has changed since the last export, this field
+      // may not exist.
+      if (isset($node->$field_name)) {
+        // Loop through all values of the field.
+        foreach ($node->$field_name as $delta => $data) {
+          $export->{$field_name}[$delta] = array();
 
-        // Save the value of each column.
-        foreach ($field['columns'] as $column => $column_data) {
-          $export->{$field_name}[$delta][$column] = $data[$column];
+          // Save the value of each column.
+          foreach ($field['columns'] as $column => $column_data) {
+            $export->{$field_name}[$delta][$column] = $data[$column];
+          }
         }
       }
     }
diff --git a/includes/modules/filefield.inc b/includes/modules/filefield.inc
index 510bbff..b5c7a09 100644
--- a/includes/modules/filefield.inc
+++ b/includes/modules/filefield.inc
@@ -15,15 +15,20 @@ function filefield_uuid_node_features_export_alter(&$export, &$pipe, $node) {
     if ($field['module'] == 'filefield') {
       $field_name = $field['field_name'];
 
-      foreach ($node->$field_name as $delta => $data) {
-        if (!empty($data['fid'])) {
-          $uuid = uuid_get_uuid('files', 'fid', $data['fid']);
-          // If the referenced file doesn't have a uuid, take this opportunity to
-          // create one.
-          if (empty($uuid)) {
-            $uuid = uuid_set_uuid('files', 'fid', $data['fid']);
+      // If the content type has changed since the last export, this field
+      // may not exist.
+      if (isset($node->$field_name)) {
+        // Loop through all values of the field.
+        foreach ($node->$field_name as $delta => $data) {
+          if (!empty($data['fid'])) {
+            $uuid = uuid_get_uuid('files', 'fid', $data['fid']);
+            // If the referenced file doesn't have a uuid, take this opportunity to
+            // create one.
+            if (empty($uuid)) {
+              $uuid = uuid_set_uuid('files', 'fid', $data['fid']);
+            }
+            $pipe['uuid_file'][$uuid] = $uuid;
           }
-          $pipe['uuid_file'][$uuid] = $uuid;
         }
       }
     }
diff --git a/includes/modules/nodereference.inc b/includes/modules/nodereference.inc
index c4fef07..e9647fa 100644
--- a/includes/modules/nodereference.inc
+++ b/includes/modules/nodereference.inc
@@ -15,15 +15,20 @@ function nodereference_uuid_node_features_export_alter(&$export, &$pipe, $node)
     if ($field['module'] == 'nodereference') {
       $field_name = $field['field_name'];
 
-      foreach ($node->$field_name as $delta => $data) {
-        if (!empty($data['nid'])) {
-          $uuid = uuid_get_uuid('node', 'nid', $data['nid']);
-          // If the referenced node doesn't have a uuid, take this opportunity to
-          // create one.
-          if (empty($uuid)) {
-            $uuid = uuid_set_uuid('node', 'nid', $data['nid']);
+      // If the content type has changed since the last export, this field
+      // may not exist.
+      if (isset($node->$field_name)) {
+        // Loop through all values of the field.
+        foreach ($node->$field_name as $delta => $data) {
+          if (!empty($data['nid'])) {
+            $uuid = uuid_get_uuid('node', 'nid', $data['nid']);
+            // If the referenced node doesn't have a uuid, take this opportunity to
+            // create one.
+            if (empty($uuid)) {
+              $uuid = uuid_set_uuid('node', 'nid', $data['nid']);
+            }
+            $pipe['uuid_node'][$uuid] = $uuid;
           }
-          $pipe['uuid_node'][$uuid] = $uuid;
         }
       }
     }
diff --git a/includes/modules/userreference.inc b/includes/modules/userreference.inc
index 49dde10..ba225cd 100644
--- a/includes/modules/userreference.inc
+++ b/includes/modules/userreference.inc
@@ -25,13 +25,17 @@ function userreference_uuid_node_features_export_render_alter(&$export, &$node,
 
       // TODO: Use user UUID's instead.
 
-      // Loop through all values of the field.
-      foreach ($node->$field_name as $delta => $data) {
-        $export->{$field_name}[$delta] = array();
+      // If the content type has changed since the last export, this field
+      // may not exist.
+      if (isset($node->$field_name)) {
+        // Loop through all values of the field.
+        foreach ($node->$field_name as $delta => $data) {
+          $export->{$field_name}[$delta] = array();
         
-        // Save the value of each column.
-        foreach ($field['columns'] as $column => $column_data) {
-          $export->{$field_name}[$delta][$column] = $data[$column];
+          // Save the value of each column.
+          foreach ($field['columns'] as $column => $column_data) {
+            $export->{$field_name}[$delta][$column] = $data[$column];
+          }
         }
       }
     }
-- 
1.6.6.1


From 490db5fb35c6d193476590836f4aec3918d3b873 Mon Sep 17 00:00:00 2001
From: Ezra Barnett Gildesgame <ezra-g@69959.no-reply.drupal.org>
Date: Fri, 24 Dec 2010 01:43:19 +0000
Subject: [PATCH 4/8] bug #884738 by ezra-g: Fixed path from code gets overridden by pathauto.

---
 includes/uuid_node.features.inc |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/includes/uuid_node.features.inc b/includes/uuid_node.features.inc
index 32bf293..741dc90 100644
--- a/includes/uuid_node.features.inc
+++ b/includes/uuid_node.features.inc
@@ -67,11 +67,14 @@ function uuid_node_features_export_render($module, $data) {
   $code[] = '';
   foreach ($data as $uuid) {
     $node = node_get_by_uuid($uuid);
+    if (!empty($node->path)) {
+      $node->pathauto_perform_alias = FALSE;
+    }
     $export = $node;
 
     // Use date instead of created, in the same format used by node_object_prepare.
     $export->date = format_date($export->created, 'custom', 'Y-m-d H:i:s O');
-    
+
     // Don't cause conflicts with the legacy nid/vid fields.
     unset($export->nid);
     unset($export->vid);
-- 
1.6.6.1


From 8959e52e99a00d70f76dcc34234f624e17a6d398 Mon Sep 17 00:00:00 2001
From: Ezra Barnett Gildesgame <ezra-g@69959.no-reply.drupal.org>
Date: Fri, 24 Dec 2010 01:46:32 +0000
Subject: [PATCH 5/8] bug #1004478 by ezra-g: Node component should revert before exported menu links

---
 uuid_features.install |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
 create mode 100644 uuid_features.install

diff --git a/uuid_features.install b/uuid_features.install
new file mode 100644
index 0000000..b8c6449
--- /dev/null
+++ b/uuid_features.install
@@ -0,0 +1,17 @@
+<?php
+
+/**
+ * Implementation of hook_enable().
+ */
+function uuid_features_enable() {
+  db_query("UPDATE {system} SET weight = -50 WHERE name = 'uuid_features' AND type = 'module'");
+}
+
+/**
+ * Update uuid_features module weight per http://drupal.org/node/1004478.
+ */
+function uuid_features_update_6100() {
+  $ret = array();
+  $ret[] = update_sql("UPDATE {system} SET weight = -50 WHERE name = 'uuid_features' AND type = 'module'");
+  return $ret;
+}
\ No newline at end of file
-- 
1.6.6.1


From f313b0b37cfecd2903582489baa4bfe8e4900bb0 Mon Sep 17 00:00:00 2001
From: Ezra Barnett Gildesgame <ezra-g@69959.no-reply.drupal.org>
Date: Fri, 31 Dec 2010 23:01:27 +0000
Subject: [PATCH 6/8] bug #1006956 by ezra-g: Invalid argument supplied for foreach warnings during profile install

---
 includes/modules/content.inc       |   36 +++++++-------
 includes/modules/filefield.inc     |   93 ++++++++++++++++++-----------------
 includes/modules/nodereference.inc |   83 ++++++++++++++++---------------
 includes/modules/userreference.inc |   39 ++++++++-------
 4 files changed, 129 insertions(+), 122 deletions(-)

diff --git a/includes/modules/content.inc b/includes/modules/content.inc
index 51f69cb..e507b62 100644
--- a/includes/modules/content.inc
+++ b/includes/modules/content.inc
@@ -13,24 +13,24 @@
  */
 function content_uuid_node_features_export_render_alter(&$export, &$node, $module) {
   $types = content_types();
-
-  // Find CCK text fields.
-  foreach ($types[$node->type]['fields'] as $field) {
-    // Let field modules do their own thing if they want.
-    if (!module_hook($field['module'], 'uuid_node_features_export_render_alter')) {
-      $field_name = $field['field_name'];
-      $export->$field_name = array();
-
-      // If the content type has changed since the last export, this field
-      // may not exist.
-      if (isset($node->$field_name)) {
-        // Loop through all values of the field.
-        foreach ($node->$field_name as $delta => $data) {
-          $export->{$field_name}[$delta] = array();
-
-          // Save the value of each column.
-          foreach ($field['columns'] as $column => $column_data) {
-            $export->{$field_name}[$delta][$column] = $data[$column];
+  if (!empty($types[$node->type])) {
+    // Find CCK text fields.
+    foreach ($types[$node->type]['fields'] as $field) {
+      // Let field modules do their own thing if they want.
+      if (!module_hook($field['module'], 'uuid_node_features_export_render_alter')) {
+        $field_name = $field['field_name'];
+        $export->$field_name = array();
+        // If the content type has changed since the last export, this field
+        // may not exist.
+        if (isset($node->$field_name)) {
+          // Loop through all values of the field.
+          foreach ($node->$field_name as $delta => $data) {
+            $export->{$field_name}[$delta] = array();
+  
+            // Save the value of each column.
+            foreach ($field['columns'] as $column => $column_data) {
+              $export->{$field_name}[$delta][$column] = $data[$column];
+            }
           }
         }
       }
diff --git a/includes/modules/filefield.inc b/includes/modules/filefield.inc
index b5c7a09..8e6cb8b 100644
--- a/includes/modules/filefield.inc
+++ b/includes/modules/filefield.inc
@@ -9,25 +9,26 @@
  */
 function filefield_uuid_node_features_export_alter(&$export, &$pipe, $node) {
   $types = content_types();
-
-  // Find CCK filefields.
-  foreach ($types[$node->type]['fields'] as $field) {
-    if ($field['module'] == 'filefield') {
-      $field_name = $field['field_name'];
-
-      // If the content type has changed since the last export, this field
-      // may not exist.
-      if (isset($node->$field_name)) {
-        // Loop through all values of the field.
-        foreach ($node->$field_name as $delta => $data) {
-          if (!empty($data['fid'])) {
-            $uuid = uuid_get_uuid('files', 'fid', $data['fid']);
-            // If the referenced file doesn't have a uuid, take this opportunity to
-            // create one.
-            if (empty($uuid)) {
-              $uuid = uuid_set_uuid('files', 'fid', $data['fid']);
+  if (!empty($types[$node->type])) {
+    // Find CCK filefields.
+    foreach ($types[$node->type]['fields'] as $field) {
+      if ($field['module'] == 'filefield') {
+        $field_name = $field['field_name'];
+  
+        // If the content type has changed since the last export, this field
+        // may not exist.
+        if (isset($node->$field_name)) {
+          // Loop through all values of the field.
+          foreach ($node->$field_name as $delta => $data) {
+            if (!empty($data['fid'])) {
+              $uuid = uuid_get_uuid('files', 'fid', $data['fid']);
+              // If the referenced file doesn't have a uuid, take this opportunity to
+              // create one.
+              if (empty($uuid)) {
+                $uuid = uuid_set_uuid('files', 'fid', $data['fid']);
+              }
+              $pipe['uuid_file'][$uuid] = $uuid;
             }
-            $pipe['uuid_file'][$uuid] = $uuid;
           }
         }
       }
@@ -40,21 +41,22 @@ function filefield_uuid_node_features_export_alter(&$export, &$pipe, $node) {
  */
 function filefield_uuid_node_features_export_render_alter(&$export, &$node, $module) {
   $types = content_types();
-
-  // Find CCK filefields.
-  foreach ($types[$node->type]['fields'] as $field) {
-    if ($field['module'] == 'filefield') {
-      $field_name = $field['field_name'];
-      $export->$field_name = array();
-
-      // Loop through all values of the field.
-      foreach ($node->$field_name as $delta => $data) {
-        if (!empty($data['fid'])) {
-          $export->{$field_name}[$delta] = array(
-            'uuid' => uuid_get_uuid('files', 'fid', $data['fid']),
-            'list' => $data['list'],
-            'data' => $data['data'],
-          );
+  if (!empty($types[$node->type])) {
+    // Find CCK filefields.
+    foreach ($types[$node->type]['fields'] as $field) {
+      if ($field['module'] == 'filefield') {
+        $field_name = $field['field_name'];
+        $export->$field_name = array();
+  
+        // Loop through all values of the field.
+        foreach ($node->$field_name as $delta => $data) {
+          if (!empty($data['fid'])) {
+            $export->{$field_name}[$delta] = array(
+              'uuid' => uuid_get_uuid('files', 'fid', $data['fid']),
+              'list' => $data['list'],
+              'data' => $data['data'],
+            );
+          }
         }
       }
     }
@@ -67,18 +69,19 @@ function filefield_uuid_node_features_export_render_alter(&$export, &$node, $mod
  */
 function filefield_uuid_node_features_rebuild_alter(&$node, $module) {
   $types = content_types();
-
-  // Find CCK nodereference fields.
-  foreach ($types[$node->type]['fields'] as $field) {
-    if ($field['module'] == 'filefield') {
-      $field_name = $field['field_name'];
-
-      // Loop through all values of the field.
-      foreach ($node->$field_name as $delta => $data) {
-        $fid = uuid_get_serial_id('files', 'fid', $data['uuid']);
-        $file = field_file_load($fid);
-
-        $node->{$field_name}[$delta] = $file + $data;
+  if (!empty($types[$node->type])) {
+    // Find CCK nodereference fields.
+    foreach ($types[$node->type]['fields'] as $field) {
+      if ($field['module'] == 'filefield') {
+        $field_name = $field['field_name'];
+  
+        // Loop through all values of the field.
+        foreach ($node->$field_name as $delta => $data) {
+          $fid = uuid_get_serial_id('files', 'fid', $data['uuid']);
+          $file = field_file_load($fid);
+  
+          $node->{$field_name}[$delta] = $file + $data;
+        }
       }
     }
   }
diff --git a/includes/modules/nodereference.inc b/includes/modules/nodereference.inc
index e9647fa..d959fab 100644
--- a/includes/modules/nodereference.inc
+++ b/includes/modules/nodereference.inc
@@ -9,25 +9,26 @@
  */
 function nodereference_uuid_node_features_export_alter(&$export, &$pipe, $node) {
   $types = content_types();
-
-  // Find CCK nodereference fields.
-  foreach ($types[$node->type]['fields'] as $field) {
-    if ($field['module'] == 'nodereference') {
-      $field_name = $field['field_name'];
-
-      // If the content type has changed since the last export, this field
-      // may not exist.
-      if (isset($node->$field_name)) {
-        // Loop through all values of the field.
-        foreach ($node->$field_name as $delta => $data) {
-          if (!empty($data['nid'])) {
-            $uuid = uuid_get_uuid('node', 'nid', $data['nid']);
-            // If the referenced node doesn't have a uuid, take this opportunity to
-            // create one.
-            if (empty($uuid)) {
-              $uuid = uuid_set_uuid('node', 'nid', $data['nid']);
+  if (!empty($types[$node->type])) {
+    // Find CCK nodereference fields.
+    foreach ($types[$node->type]['fields'] as $field) {
+      if ($field['module'] == 'nodereference') {
+        $field_name = $field['field_name'];
+  
+        // If the content type has changed since the last export, this field
+        // may not exist.
+        if (isset($node->$field_name)) {
+          // Loop through all values of the field.
+          foreach ($node->$field_name as $delta => $data) {
+            if (!empty($data['nid'])) {
+              $uuid = uuid_get_uuid('node', 'nid', $data['nid']);
+              // If the referenced node doesn't have a uuid, take this opportunity to
+              // create one.
+              if (empty($uuid)) {
+                $uuid = uuid_set_uuid('node', 'nid', $data['nid']);
+              }
+              $pipe['uuid_node'][$uuid] = $uuid;
             }
-            $pipe['uuid_node'][$uuid] = $uuid;
           }
         }
       }
@@ -40,18 +41,19 @@ function nodereference_uuid_node_features_export_alter(&$export, &$pipe, $node)
  */
 function nodereference_uuid_node_features_export_render_alter(&$export, &$node, $module) {
   $types = content_types();
-
-  // Find CCK nodereference fields.
-  foreach ($types[$node->type]['fields'] as $field) {
-    if ($field['module'] == 'nodereference') {
-      $field_name = $field['field_name'];
-      $export->$field_name = array();
-
-      // Loop through all values of the field.
-      foreach ($node->$field_name as $delta => $data) {
-        if (!empty($data['nid'])) {
-          $uuid = uuid_get_uuid('node', 'nid', $data['nid']);
-          $export->{$field_name}[$delta] = $uuid;
+  if (!empty($types[$node->type])) {
+    // Find CCK nodereference fields.
+    foreach ($types[$node->type]['fields'] as $field) {
+      if ($field['module'] == 'nodereference') {
+        $field_name = $field['field_name'];
+        $export->$field_name = array();
+  
+        // Loop through all values of the field.
+        foreach ($node->$field_name as $delta => $data) {
+          if (!empty($data['nid'])) {
+            $uuid = uuid_get_uuid('node', 'nid', $data['nid']);
+            $export->{$field_name}[$delta] = $uuid;
+          }
         }
       }
     }
@@ -64,16 +66,17 @@ function nodereference_uuid_node_features_export_render_alter(&$export, &$node,
  */
 function nodereference_uuid_node_features_rebuild_alter(&$node, $module) {
   $types = content_types();
-
-  // Find CCK nodereference fields.
-  foreach ($types[$node->type]['fields'] as $field) {
-    if ($field['module'] == 'nodereference') {
-      $field_name = $field['field_name'];
-
-      // Loop through all values of the field.
-      foreach ($node->$field_name as $delta => $uuid) {
-        $nid = uuid_get_serial_id('node', 'nid', $uuid);
-        $node->{$field_name}[$delta] = array('nid' => $nid);
+  if (!empty($types[$node->type])) {
+    // Find CCK nodereference fields.
+    foreach ($types[$node->type]['fields'] as $field) {
+      if ($field['module'] == 'nodereference') {
+        $field_name = $field['field_name'];
+  
+        // Loop through all values of the field.
+        foreach ($node->$field_name as $delta => $uuid) {
+          $nid = uuid_get_serial_id('node', 'nid', $uuid);
+          $node->{$field_name}[$delta] = array('nid' => $nid);
+        }
       }
     }
   }
diff --git a/includes/modules/userreference.inc b/includes/modules/userreference.inc
index ba225cd..626983d 100644
--- a/includes/modules/userreference.inc
+++ b/includes/modules/userreference.inc
@@ -16,25 +16,26 @@ function userreference_uuid_node_features_export_render(&$export, &$pipe, $node)
  */
 function userreference_uuid_node_features_export_render_alter(&$export, &$node, $module) {
   $types = content_types();
-
-  // Find CCK userreference fields.
-  foreach ($types[$node->type]['fields'] as $field) {
-    if ($field['module'] == 'userreference') {
-      $field_name = $field['field_name'];
-      $export->$field_name = array();
-
-      // TODO: Use user UUID's instead.
-
-      // If the content type has changed since the last export, this field
-      // may not exist.
-      if (isset($node->$field_name)) {
-        // Loop through all values of the field.
-        foreach ($node->$field_name as $delta => $data) {
-          $export->{$field_name}[$delta] = array();
-        
-          // Save the value of each column.
-          foreach ($field['columns'] as $column => $column_data) {
-            $export->{$field_name}[$delta][$column] = $data[$column];
+  if (!empty($types[$node->type])) {
+    // Find CCK userreference fields.
+    foreach ($types[$node->type]['fields'] as $field) {
+      if ($field['module'] == 'userreference') {
+        $field_name = $field['field_name'];
+        $export->$field_name = array();
+  
+        // TODO: Use user UUID's instead.
+  
+        // If the content type has changed since the last export, this field
+        // may not exist.
+        if (isset($node->$field_name)) {
+          // Loop through all values of the field.
+          foreach ($node->$field_name as $delta => $data) {
+            $export->{$field_name}[$delta] = array();
+          
+            // Save the value of each column.
+            foreach ($field['columns'] as $column => $column_data) {
+              $export->{$field_name}[$delta][$column] = $data[$column];
+            }
           }
         }
       }
-- 
1.6.6.1


From b9f74eaaf11114ca57efd2095e73f3a6a88a4d01 Mon Sep 17 00:00:00 2001
From: Ezra Barnett Gildesgame <ezra-g@69959.no-reply.drupal.org>
Date: Fri, 7 Jan 2011 20:31:53 +0000
Subject: [PATCH 7/8] bug #1011828 by ezra-g: PHP errors when clearing site cache

---
 includes/modules/content.inc       |    3 +--
 includes/modules/filefield.inc     |    2 +-
 includes/modules/nodereference.inc |    2 +-
 includes/modules/taxonomy.inc      |    2 +-
 includes/modules/userreference.inc |    2 +-
 includes/uuid_node.features.inc    |    2 +-
 6 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/includes/modules/content.inc b/includes/modules/content.inc
index e507b62..f1b04d8 100644
--- a/includes/modules/content.inc
+++ b/includes/modules/content.inc
@@ -11,8 +11,7 @@
  * For most CCK fields, it is enough to simply add the values from each db
  * column into a field array.
  */
-function content_uuid_node_features_export_render_alter(&$export, &$node, $module) {
-  $types = content_types();
+function content_uuid_node_features_export_render_alter(&$export, $node, $module) {
   if (!empty($types[$node->type])) {
     // Find CCK text fields.
     foreach ($types[$node->type]['fields'] as $field) {
diff --git a/includes/modules/filefield.inc b/includes/modules/filefield.inc
index 8e6cb8b..f6f1773 100644
--- a/includes/modules/filefield.inc
+++ b/includes/modules/filefield.inc
@@ -39,7 +39,7 @@ function filefield_uuid_node_features_export_alter(&$export, &$pipe, $node) {
 /**
  * Implementation of hook_uuid_node_features_export_render_alter().
  */
-function filefield_uuid_node_features_export_render_alter(&$export, &$node, $module) {
+function filefield_uuid_node_features_export_render_alter(&$export, $node, $module) {
   $types = content_types();
   if (!empty($types[$node->type])) {
     // Find CCK filefields.
diff --git a/includes/modules/nodereference.inc b/includes/modules/nodereference.inc
index d959fab..472f9aa 100644
--- a/includes/modules/nodereference.inc
+++ b/includes/modules/nodereference.inc
@@ -39,7 +39,7 @@ function nodereference_uuid_node_features_export_alter(&$export, &$pipe, $node)
 /**
  * Implementation of hook_uuid_node_features_export_render_alter().
  */
-function nodereference_uuid_node_features_export_render_alter(&$export, &$node, $module) {
+function nodereference_uuid_node_features_export_render_alter(&$export, $node, $module) {
   $types = content_types();
   if (!empty($types[$node->type])) {
     // Find CCK nodereference fields.
diff --git a/includes/modules/taxonomy.inc b/includes/modules/taxonomy.inc
index 8f473f3..d530e1d 100644
--- a/includes/modules/taxonomy.inc
+++ b/includes/modules/taxonomy.inc
@@ -28,7 +28,7 @@ function taxonomy_uuid_node_features_export_alter(&$export, &$pipe, $node) {
 /**
  * Implementation of hook_uuid_node_features_export_render_alter().
  */
-function taxonomy_uuid_node_features_export_render_alter(&$export, &$node, $module) {
+function taxonomy_uuid_node_features_export_render_alter(&$export, $node, $module) {
   if (!empty($node->taxonomy)) {
     $export->uuid_term = array();
     foreach ($node->taxonomy as $term) {
diff --git a/includes/modules/userreference.inc b/includes/modules/userreference.inc
index 626983d..5d6315c 100644
--- a/includes/modules/userreference.inc
+++ b/includes/modules/userreference.inc
@@ -14,7 +14,7 @@ function userreference_uuid_node_features_export_render(&$export, &$pipe, $node)
 /**
  * Implementation of hook_uuid_node_features_export_render_alter().
  */
-function userreference_uuid_node_features_export_render_alter(&$export, &$node, $module) {
+function userreference_uuid_node_features_export_render_alter(&$export, $node, $module) {
   $types = content_types();
   if (!empty($types[$node->type])) {
     // Find CCK userreference fields.
diff --git a/includes/uuid_node.features.inc b/includes/uuid_node.features.inc
index 741dc90..ce97850 100644
--- a/includes/uuid_node.features.inc
+++ b/includes/uuid_node.features.inc
@@ -80,7 +80,7 @@ function uuid_node_features_export_render($module, $data) {
     unset($export->vid);
 
     // The hook_alter signature is:
-    // hook_uuid_node_features_export_render_alter(&$export, &$node, $module);
+    // hook_uuid_node_features_export_render_alter(&$export, $node, $module);
     drupal_alter('uuid_node_features_export_render', $export, $node, $module);
 
     $code[] = '  $nodes[] = '. features_var_export($export, '  ') .';';
-- 
1.6.6.1


From 7b93f398677ea0af22155c9cca73815f443868bf Mon Sep 17 00:00:00 2001
From: pifantastic <aaron.forsander@gmail.com>
Date: Fri, 11 Mar 2011 14:40:37 -0600
Subject: [PATCH 8/8] Line breaks cause exported strings to be indented which forces them to show as overridden when compared against the database value.

---
 includes/uuid_node.features.inc |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/includes/uuid_node.features.inc b/includes/uuid_node.features.inc
index ce97850..a3a114a 100644
--- a/includes/uuid_node.features.inc
+++ b/includes/uuid_node.features.inc
@@ -83,7 +83,7 @@ function uuid_node_features_export_render($module, $data) {
     // hook_uuid_node_features_export_render_alter(&$export, $node, $module);
     drupal_alter('uuid_node_features_export_render', $export, $node, $module);
 
-    $code[] = '  $nodes[] = '. features_var_export($export, '  ') .';';
+    $code[] = '  $nodes[] = '. features_var_export($export) .';';
   }
 
   if (!empty($translatables)) {
-- 
1.6.6.1

