Index: core/node.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/install_profile_api/core/Attic/node.inc,v
retrieving revision 1.1.2.3
diff -u -F^f -u -F^f -r1.1.2.3 node.inc
--- core/node.inc	7 Jan 2009 23:16:27 -0000	1.1.2.3
+++ core/node.inc	20 Mar 2009 06:14:04 -0000
@@ -42,4 +42,61 @@ function install_create_content_type($co
 
   $type = (object)_node_type_set_defaults($type);
   node_type_save($type);
+}
+
+/**
+ * Given a title and body, and an array of custom properties, create
+ * a node.
+ *
+ * @param $title
+ *   Optional. The node title.
+ * @param $body
+ *   Optional. The node body.
+ * @param $properties
+ *   Optional. An array of properties that describe the node.
+ */
+function install_create_node($title = NULL, $body = NULL, $properties = array()) {
+  $properties['nid'] = NULL; // Force creation of new node.
+  $properties['title'] = $title;
+  $properties['body'] = $body;
+  $node = install_save_node($properties);
+  return $node;
+}
+
+/**
+ * Given an array of custom properties, save a node. This function is
+ * written to be self-documenting, as it explicitly lists the properties
+ * you can set, and shows the defaults if you don't set them.
+ *
+ * @param $properties
+ *   Optional. An array of properties that describe the node.
+ */
+function install_save_node($properties = array()) {
+
+  // If name has been passed as a property, convert it to a uid.
+  if (isset($properties['name'])) {
+    if (!($account = user_load(array('name' => $properties['name'])))) {
+      drupal_set_message(t('Failed to load Drupal user %user -- node %title not saved.', array('%name' => $properties['name'], '%title' => $properties['title'])), 'error', FALSE);
+      return;
+    }
+  }
+
+  $default = array(
+    'nid' => isset($properties['nid']) ? $properties['nid'] : NULL, // Defaults to NULL, which creates a new node.
+    'title' => !empty($properties['title']) ? $properties['title'] : '-- no title--', // Defaults to '-- no title --'.
+    'body' => NULL, // Defaults to no body.
+    'type' => 'page',
+    'teaser' => NULL,
+    'log' => '',
+    'created' => '',
+    'format' => FILTER_FORMAT_DEFAULT,
+    'uid' => isset($account) ? $account->uid : 0,
+
+  );
+  $node = array_merge($default, $properties);
+
+  $node = (object) $node;
+  node_save($node);
+
+  return $node;
 }
\ No newline at end of file
