Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
File migration configuration settings are confusing and need better documentation.
source
- conf_path - This is the source site path to the active configuration for the content to be migrated. For example, if the source site files are located at http://mysite.com/sites/default/files/, then the conf_path is "sites/default" (which is the default value). If the source site files are located at http://subdomain.mysite.dev/sites/subdomain/files, then the conf_path is "sites/subdomain".
destination
- source_base_path - This is the absolute path to the site for the content to be migrated. Depending on the setting of the "source_path_property" (see next item) this can be either a local filepath (/var/www/mysite.dev) or a uri (http://mysite.dev) - no trailing slash in either case.
- source_path_property - can be set to "filepath" or "uri".
- destination_path_property - can be set to "filepath or "uri", defaults to "uri" (under what conditions would this need to be overridden?)
- move - set whether source files are moved or copied from the source - defaults to "FALSE" (copied).
- urlencode - set whether source file URL needs to be urlencoded prior to copy/move - defaults to FALSE.
- rename - set whether a file is renamed or replaced copied from source to destination if the file already exists - defaults to FALSE (replaced).
Proposed resolution
Figure out what all the parameters mean, and document them here: https://www.drupal.org/node/2257723
Remaining tasks
Post list of all configuration settings then have big brains fill in any blanks.
User interface changes
None.
API changes
None.
Comments
Comment #1
ultimikeA couple of notes:
I think it is a little counterintuitive that different parts of the source URL to a file would be split between the "source" and "destination" configuration values. Not sure if there is anything we can do about it, but I figured I'd mention it.
Comment #2
ultimikeComment #3
benjy CreditAttribution: benjy at CodeDrop commentedI believe some of these settings came across from D7 so mikeryan might be the best person to comment on some of them. I'm guessing destination_path_property is configurable to be flexible between different media storage such as core files, file entity etc.
Comment #4
mikeryanI haven't looked closely at file migration - urlencode is the only one I see that comes directly from D7. First thing, we need to distinguish between configuration that's part of the migrate module's file destination plugin, from stuff that migrate_drupal adds for Drupal 6/7 file sources. Question: is https://www.drupal.org/node/2257723 supposed to be for migrations to Drupal 8 in general, or just for D6/D7 upgrades? The title suggests the former but the content seems to focus on the latter...
Anyway, I don't know the D8 file plugin well enough (yet) to definitively explain how it constructs the paths, but I suggest looking at https://www.drupal.org/node/1540106 for a model - this gives examples of how source_dir, destination_dir, and destination_file apply in D7.
Comment #6
mikeryanThis is changing shortly - once #2695297: Refactor EntityFile and use process plugins instead is committed we should update the documentation accordingly.
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous at Netuxo Ltd (RIP) commentedAre you sure there shouldn't be a trailing slash after source_base_path? When I did not add a trailing slash, migration of files did not work, and I could see in the migrate_message_upgrade_d6_file table messages that file /path/to/files/without/slashfiles/ does not exist. So it did just add "files/", and did not put a slash between the source_base_path and "files". Adding the trailing slash to source_base_path made it work.
Comment #8
mikeryan#2695297: Refactor EntityFile and use process plugins instead is in, unblocking. It ended up going into 8.2.x and later, so do we need to document both the old and new ways?
@Andreas Speck - It actually shouldn't matter if you provide a trailing slash, it will be added in if necessary. Definitely in the 8.2.x version, at least, but it certainly looked like 8.1.x was ensuring a trailing slash (adding it if necessary).
Comment #10
xenophyle CreditAttribution: xenophyle commentedBased on the issue mentioned in #8, this documentation is now completely wrong. I would like to fix it when I have the chance, but if someone else does it first, I won't be mad.
Comment #11
mikeryanIdeally that page would be deleted entirely, since there is no longer any configuration specific to entity:file, but in the meantime I've edited it to remove the obsolete configuration.
Comment #14
quietone CreditAttribution: quietone as a volunteer commentedThis is d.o documentation (tagged) and should be in the api docs as well.
Comment #16
masipila CreditAttribution: masipila as a volunteer commentedI'll close this issue as outdated (as there are no longer any configuration options).
I'll open a new issue for writing a handbook example on how to migrate files from non-Drupal source systems.
Markus
Comment #17
masipila CreditAttribution: masipila as a volunteer commentedI opened a separate issue for documenting an example on how to migrate files from non-Drupal source, see #2953166: Migrate handbook page for migrating files from non-Drupal source