...and also if you use the '--update' modifier in drush.

I have a very large dataset on my site that I'd rather update than wipe out and reimport every day, and if I run the 'update' rather than clear and reimport, all the nodes that are updated have their path aliases removed.

In addition, if I go to edit the imported node, the 'Automatic alias' checkbox in the "URL path settings" fieldset is unchecked, so if I want to simply run a batch update of path aliases via Pathauto, I still can't update the path aliases to get them back to what they were previously (before migrate --update).

Comments

geerlingguy’s picture

I fixed the issue on my site by going to pathauto's URL alias settings at admin/build/path/pathauto and setting 'Update action' to "Create a new alias. Redirect from old alias."

However, this is not ideal - if someone didn't want their aliases to change, then the aliases for any migrated nodes would be dumped...

erikwebb’s picture

Title: Path Aliases removed if "Update Previously Imported Content" is Checked » Path Aliases removed when Pathauto uses "Update Previously Imported Content"
Priority: Normal » Major
Issue tags: +pathauto

Using Migrate alongside Pathauto seems like a crucial combination. Creating unnecessary aliases just as a workaround is less than ideal, it's quite hacky.

Any other workarounds people have found?

erikwebb’s picture

I wrote a workaround using hook_migrate_complete_DESTINATION(). It basics removes any aliases created during the import process and manually creates the new link using the proper field.

Here's the ugly workaround I've setup -


/**
 * Implementation of hook_migrate_complete_DESTINATION().
 *
 * Ensure proper path creation.
 */
function mymodule_migrate_complete_node(&$node, $tblinfo, $row) {
  switch ($node->type) {
    case 'page':
      path_set_alias('node/' . $node->nid);
      path_set_alias('node/' . $node->nid, $row->table_name_url_field);
      break;
  }
}
geerlingguy’s picture

Yikes - that would need to be done for each content type, I presume...

mikeryan’s picture

Project: Migrate » Migrate Extras
Version: 6.x-1.0 » 6.x-1.x-dev
Component: Code » Miscellaneous
Priority: Major » Normal

Contrib module support goes into the Migrate Extras module. Not sure if this will get looked at closely, V1 is not a priority any more, but any patches will be considered.

mikeryan’s picture

Status: Active » Closed (cannot reproduce)

Migrate and Migrate Extras V1 are no longer supported, and I can't reproduce this situation with V2.