I spent about an hour trying to decipher the MigrateFile class 'DestinationDir' sub-field, with file migrations failing, even though the files were available. The problem was a misinterpretation of the nature of the field value.

The migrate field description is: "Path within Drupal files directory to store file"

This is not clear. The default value for the sub-field is 'public://'. The variable holds a full Drupal File Scheme uri. Any passed values need to still be a full uri, not a path for inside the files directory (public://[path_inside_files_directory]).

In my case it was hard to determine where the file migration was failing. I had a subfolder for inside the files directory, which as an absolute url the server didn't have the permissions to create.

Perhaps something like this would be more clear: "Drupal path uri to the directory to store file (defaults to public://)"

I am not sure how comfortable most migrators are with the Drupal URI schemes, but I would assume that the level is high, so just seeing the default suggestion would inform that a scheme uri is used.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jaxxed’s picture

Here is a patch using my example text

jaxxed’s picture

Status: Patch (to be ported) » Needs review
mikeryan’s picture

Status: Needs review » Needs work

"Drupal path uri directory" doesn't make much sense to me. How about "Drupal path of parent directory to hold the file"?

pifagor’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)