0

Say I drag and drop files from a source site into the folder structure of a new site (destination site) that I'm migrating content to. The source sites file paths are the exact same as the destinations paths.

Source: sites/default/files/attachments

Destination: sites/default/files/attachments

So instead of migrating the actual file I just need Drupal to point to the same location as the source site and the file will be there but when migrating the files over it wants to migrate the entire file.

Is this possible? Maybe after content migration I will need to reconfigure the attachments paths?

1

Say I drag and drop files from a source site into the folder structure of a new site (destination site) that I'm migrating content to.

Dont do this. Migrate D2D has file handling classes to move the files for you. In the UI it's super easy, in code you select the correct file handing class.

Read the documentation on migrating files for D2D. There are 4 cases it supports, depending on how the remote file needs to be fetched.

In the D2D UI you just want to be sure to setup the File_class value for your migration ok. Typically the Files are migrated (moved) to Drupal as 1 of the 1st auto-generated migrations. Then in Node content that relates the migrated files to the (migrated) Node you set file class to FileFID and select the previous Source Migration that moved the file into the new site.

EDIT

So for example with a website with existing image fields in a content type. On the destination Drupal 7 side of the migration I tell it the legacy field and tell the configuration to use MigrateFileFID this will map just the file ID between the 2 drupal instances:

enter image description here

See field_ofellow_photo above for an example of this configuration for D6 -> D7.

Then Migrate will see the information for the migration steps:

enter image description here

If you use MigrateFileFID then Migrate doesnt (necessarily) move the files I believe if you leave off the destination information, it just moves FIDs. See the documentation on MigrateDesinationFile and MigrateFileFid.

  • Thanks Ill check it out. There are like 10 gigs worth of files do you think migrate can handle that much? – cwahlfeldt Apr 15 '16 at 19:22
  • You can move the directory by hand and use the FID file class and map to the legacy drupal 6 FID. – tenken Apr 15 '16 at 19:29
  • That sounds good! How would I go about it in the UI? Would I need to create a custom class file and then track it down some how? – cwahlfeldt Apr 15 '16 at 19:34
  • please see my edits above. I can't offer any more help at this time. If needed you can create your own migrate destination file class. That is covered in the linked documentation I provided. – tenken Apr 19 '16 at 19:58
  • Worked like a charm! Just had to add MigrateFileFid to the default of that field option and bam they came over. Thanks @tenken! – cwahlfeldt Apr 19 '16 at 20:17
0

You can set up the field mapping to reuse existing files:

$this->addFieldMapping('destination_file_field','source_file_field');
$this->addFieldMapping('destination_file_field:file_replace')->defaultValue(MigrateFile::FILE_EXISTS_REUSE);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.