Another way (see a related issue) to export the files is to add them directly to the archive while exporting the content. The idea is taken from - a drush patch which handles not only drush commands but also takes care about the files.
However, I think that it would be better to handle the files attached to a certain entity while processing this entity, rather than export all the files together on the last batch operation call. Exporting all the files at once might be bad in terms of performance.
In the future, I plan to improve a Single Entity Export form - I want it to produce an archive with all dependent entities and the files instead of generating a raw yml text without any dependency, so being able to export only the files of a single entity would be handy in this case.
| Comment | File | Size | Author |
|---|---|---|---|
| content_sync-files_in_archive-0-D8.patch | 1.1 KB | klimp |
Comments
Comment #2
klimpupd: seems it doesn't work with Drupal 8.5. Because of the arguments number passed to the pack() function in Drupal\Core\Archiver\ArchiveTar->_writeHeader(). Drupal 8.5 passes 6 arguments (and complains - not enough arguments, an archive is damaged), Drupal 8.6 passes 7 arguments (fine)
A part of diff output comparing Drupal 8.6 against Drupal 8.5
Comment #3
blanca.esqueda commentedThanks!
As posted in other issues, the functionality for import/export dependencies can be found in:
https://www.drupal.org/project/content_sync/issues/2873074#comment-13019230
I think we had the same ideas, I changed the part of moving all files the end weeks ago when I was working on organizing the entities by collections. The functionality to export files as the entity is being processed is almost the same as the patch you added so I credited you for the commit of that functionality (commits in content_sync Github repository are the ones that will be pushed for the next Drupal release).
Comment #5
blanca.esqueda commented