You are here

function taxonomy_xml_invoke_import_on_filepath in Taxonomy import/export via XML 6.2

Load a vocabulary from the given local filepath and import it

2 calls to taxonomy_xml_invoke_import_on_filepath()
taxonomy_xml_fetch_and_import in ./taxonomy_xml.module
Fetches the data according to the given method, then invokes the import on that data.
taxonomy_xml_invoke_service_request in ./taxonomy_xml.module
Make a request on a remote taxonomy server and process the response

File

./taxonomy_xml.module, line 713
This module makes it possible to import and export taxonomies as XML documents.

Code

function taxonomy_xml_invoke_import_on_filepath($filepath, $form_values) {

  // Retrieve local file and parse it
  if ($filepath) {
    $text = file_get_contents($filepath);
    if (!empty($text)) {
      drupal_set_message(t('Retrieved file %filepath. Now starting a %format import process.', array(
        '%filepath' => $filepath,
        '%format' => $form_values['format'],
      )));
      return taxonomy_xml_invoke_import($text, $form_values, $filepath);
    }
    else {
      drupal_set_message(t('<strong>Taxonomy XML</strong>: Failed to retrieve content from %filepath. Check this file exists and is readable', array(
        '%filepath' => $filepath,
      )), 'error');
    }
  }
  else {
    drupal_set_message(t('<strong>Taxonomy XML</strong>: No filepath. A valid, readable file path is required.'), 'error');
  }
  return FALSE;
}