Migrate Upload Source

Categories

Component ID

2317219

Component name

Migrate Upload Source

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

Provides an upload widget for your migration users to be able to upload source files (CSV, XML, etc) through the UI.

Very experimental, don't use it as is, without reviewing the code and making the modifications that suit your needs.

After installing this module you'll see a new TAB under /admin/content/migrate, to "Upload Source File". Once the source file is uploaded, you can use it in your migrate class by retrieving the value of the variable "migrate_upload_source_file_path".

An example of implementation could be:

    // (...)
    $sourcefile = variable_get('migrate_upload_source_file_path');
    if (!empty($sourcefile)) {
      $source_path = DRUPAL_ROOT . '/' . $sourcefile;
      $this->source = new MigrateSourceCSV($source_path, $columns, $options);
    }
    else {
      drupal_set_message(t('You need to upload a file in order to be able to use this migration class.'), 'warning');
      $this->source = new MigrateSourceCSV('foo.txt', $columns, $options);
    }
    // (...)