MigrateUpgradeImportBatch does not use source_private_file_path & source_base_path correctly, making it impossible to have public & private files in separate locations

Created on 23 November 2017, about 7 years ago
Updated 11 September 2023, over 1 year ago

Problem/Motivation

I am trying to migrate drupal 7.56 to 8.4.2 using migrate_drupal and migrate_drupal_ui web interface.
The instructions for file path seems to be misleading.

It is asking to enter "Public file directory" and "Private file directory". The variables seems to be interchanged i.e., the Public_file_path value is being used for importing private files. with this, Private files are getting imported.
Public file path is becoming "private_file_path/sites/default/files..." and public file import is being failed.

If both the values are entered, i.e., public_file_directory for public and private_file_directory for private, the values are becoming "file://public_file_path///private_file_path".

Proposed resolution

Change the ReviewForm so that both the source_base_path and the source_private_path are added to the batch configuration.

Then in MigrateUpgradeImportBatch, for all file migrations, set the source_base_path constant of the source plugin. Use the scheme property of the source plugin, $definition['source']['scheme'], to select the public or private base path entered by the user on the CredentialForm.

Add a new functional test, FilePathTest, to confirm the proposed resolution truly works.

Remaining tasks

  • Change record
  • Release notes snippet

User interface changes

N/A

API changes

Data model changes

Release notes snippet

When Drupal 7-to-Drupal migrations are run through the user interface, the 'Private file directory' is now used correctly as the base source path for the private files.

🐛 Bug report
Status

Fixed

Version

9.2

Component
Migration 

Last updated about 1 hour ago

Created by

🇮🇳India raveendrab

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024