Index: install_profile_api/contrib/content_copy.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/install_profile_api/contrib/Attic/content_copy.inc,v retrieving revision 1.1.2.4 diff -u -p -r1.1.2.4 content_copy.inc --- install_profile_api/contrib/content_copy.inc 19 Nov 2008 22:23:25 -0000 1.1.2.4 +++ install_profile_api/contrib/content_copy.inc 13 Apr 2009 23:18:40 -0000 @@ -40,3 +40,20 @@ function install_content_copy_import_fro // again within this submit function. content_copy_import_form_submit($form, $form_state); } + +/** + * Import all CCK exports in a directory. + * + * @param $path + * The directory that the CCK exports are stored in. + **/ +function install_content_copy_import_directory($path) { + if (!is_dir($path) || !is_readable($path)) { + drupal_set_message(t("Could not import CCK exports from '!path'. The location is not a directory or not readable.", array('!path' => $path)), 'error'); + return FALSE; + } + + foreach (glob($path . '/*.inc') as $filename) { + install_content_copy_import_from_file($filename); + } +} Index: install_profile_api/contrib/export.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/install_profile_api/contrib/Attic/export.inc,v retrieving revision 1.1.2.2 diff -u -p -r1.1.2.2 export.inc --- install_profile_api/contrib/export.inc 20 Mar 2009 21:15:47 -0000 1.1.2.2 +++ install_profile_api/contrib/export.inc 13 Apr 2009 23:18:40 -0000 @@ -54,11 +54,17 @@ function install_node_export_import_from foreach ($imported_nodes as $node) { $node = (object) $node; + $original_node = drupal_clone($node); foreach ($properties as $key => $value) { $node->$key = $value; } + // Let other modules do special fixing up. + // The function signature is: hook_export_node_alter(&$node, $original_node, $method) + // Where $method is either 'prepopulate' or 'save-edit'. + drupal_alter("export_node", $node, $original_node, "save-edit"); + node_save($node); $saved_nodes[] = $node; @@ -66,3 +72,28 @@ function install_node_export_import_from return $saved_nodes; } + +/** + * Import all node exports in a directory. + * + * @param $path + * The directory that the node exports are stored in. + * @param $properties + * Node properties to override on each imported node. + * @param $author + * The author to set for each imported node. + **/ +function install_node_export_import_directory($path, $properties = array(), $author = NULL) { + if (!is_dir($path) || !is_readable($path)) { + drupal_set_message(t("Could not import node exports from '!path'. The location is not a directory or not readable.", array('!path' => $path)), 'error'); + return FALSE; + } + + $nodes = array(); + + foreach (glob($path . '/*.inc') as $filename) { + $nodes[$filename] = install_node_export_import_from_file($filename, $properties, $author); + } + + return $nodes; +} Index: install_profile_api/contrib/views.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/install_profile_api/contrib/Attic/views.inc,v retrieving revision 1.1.2.1 diff -u -p -r1.1.2.1 views.inc --- install_profile_api/contrib/views.inc 15 Jan 2009 19:29:50 -0000 1.1.2.1 +++ install_profile_api/contrib/views.inc 13 Apr 2009 23:18:40 -0000 @@ -38,3 +38,23 @@ function install_views_ui_import_from_fi // Remove this view from cache so we can edit it properly. views_object_cache_clear('view', $form_state['view']->name); } + +/** + * Import all view exports in a directory. + **/ +function install_views_ui_import_directory($path) { + if (!is_dir($path) || !is_readable($path)) { + drupal_set_message(t("Could not import view exports from '!path'. The location is not a directory or not readable.", array('!path' => $path)), 'error'); + return FALSE; + } + + $results = array(); + + foreach (glob($path . '/*.inc') as $filename) { + $result = install_views_ui_import_from_file($filename); + + $results[$filename] = ($result !== FALSE) ? TRUE : FALSE; + } + + return $results; +}