- Issue created by @drupalfan2
- 🇳🇿New Zealand quietone
Changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to our policies.
- 🇳🇿New Zealand quietone
I did notice that the path is set in both the UI and in settings.php. It only needs to be set in one place. And the patch should not include the public path as well. So, instead of '/var/www/html/web-d7/sites/default/files' it probably should be '/var/www/html/web-d7/sites/default/files'. Can you try that and report back?
Since this functionality is tested I am changing to a support request, it can be changed back if a bug is found.
- 🇫🇷France jibus
I have the exact same problem. I don't understand how to transfer files. I tried several path without success
So, instead of '/var/www/html/web-d7/sites/default/files' it probably should be '/var/www/html/web-d7/sites/default/files'.
Shouldn't be /var/www/html/web-d7 ?
- Status changed to Postponed: needs info
4 months ago 8:38am 13 May 2025 - 🇳🇱Netherlands ndf Amsterdam
I ended up by overriding
\Drupal\file\Plugin\migrate\source\d7\File::initializeIterator()
That methods reads the public and private paths from variables in the source (Drupal 7) database. And these are then used to process the file migrations. And that triggered to this error:
message = "file_copy: File '/pdf-file.pdf' does not exist" *Exception*string = "" code = {int} 0 file = "/var/www/html/docroot/core/modules/migrate/src/MigrateExecutable.php" line = {int} 462 *Exception*trace = {array[19]} *Exception*previous = null level = {int} 1 status = {int} 3 $id_map = {Drupal\migrate_tools\IdMapFilter} $msg = "d7_file_private:uri:file_copy: File '/pdf-file.pdf' does not exist"
Instead I override it with hardcoded paths. In the example below the original code in still in place for reference.
# docroot/core/modules/file/src/Plugin/migrate/source/d7/File.php # \Drupal\file\Plugin\migrate\source\d7\File::initializeIterator /** * {@inheritdoc} */ protected function initializeIterator() { $this->publicPath = $this->variableGet('file_public_path', 'sites/default/files'); $this->privatePath = $this->variableGet('file_private_path', NULL); // Patch start: override public and private paths with ddev mounts inside the target container. $this->publicPath = '/var/www/html/drupal7_migration_mounts/public_mount'; $this->privatePath = '/var/www/html/drupal7_migration_mounts/private_mount'; // Patch stop: override public and private paths with ddev mounts inside the target container. return parent::initializeIterator(); }
Same here, I had to hack
/core/modules/file/src/Plugin/migrate/source/d7/File.php
for it to work.