Ensure that migrations of entities which have file or image fields depend on private/public files migration

Created on 31 March 2020, about 5 years ago
Updated 24 July 2024, 9 months ago

Problem/Motivation

Right now, entities which have file or image fields can be migrated without the corresponding file migration, that ends in incomplete entity migrations (with stubbed files..).

Proposed resolution

Make these kind of content entity migrations depend on private/public files migration.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

✨ Feature request
Status

Needs work

Version

11.0 πŸ”₯

Component
MigrationΒ  β†’

Last updated 5 days ago

Created by

πŸ‡­πŸ‡ΊHungary huzooka Hungary πŸ‡­πŸ‡ΊπŸ‡ͺπŸ‡Ί

Live updates comments and jobs are added and updated live.
  • Needs change record

    A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

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

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    New edge case discovered when using https://www.drupal.org/project/file_entity β†’ . This updated patch adds protection for it.

  • Status changed to Needs work about 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Next patch can we change the name of it, unless it's not meant to be tested?

    addFileMigrationDependencies
    Can this be typehinted since it's a new function?

    file.migration.dependency.manager:
    As a new service believe this will need a change record.

    The edge case you mentioned in #16 could that be added to the issue summary too please.

    Thanks!

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί
  • First commit to issue fork.
  • Pipeline finished with Failed
    10 months ago
    Total: 170s
    #190694
  • Pipeline finished with Failed
    10 months ago
    Total: 170s
    #190715
  • πŸ‡ͺπŸ‡ΈSpain fjgarlin

    Changing patch to MR to allow easier review.

  • Pipeline finished with Failed
    10 months ago
    #190720
  • Pipeline finished with Failed
    10 months ago
    Total: 188s
    #191623
  • πŸ‡ͺπŸ‡ΈSpain fjgarlin

    @smustgrave - What you you mean by "...addFileMigrationDependencies... Can this be typehinted since it's a new function?"

  • Pipeline finished with Failed
    10 months ago
    Total: 514s
    #191632
  • Pipeline finished with Failed
    9 months ago
    Total: 552s
    #224889
  • πŸ‡ΊπŸ‡ΈUnited States agentrickard Georgia (US)

    The latest patch introduces a hard dependency on migrate module inside file.module. That is not really acceptable, as it can cause errors in install from config.

    Fatal error: During class fetch: Uncaught ReflectionException: Class "Drupal\migrate\Plugin\MigrationDeriverTrait" not found while loading "Drupal\file\FileMigrationDependencyManager". in /var/www/html/vendor/composer/ClassLoader.php:576 Stack trace: #0 [internal function]: Composer\Autoload\ClassLoader->loadClass('Drupal\\file\\Fil...') #1 /var/www/html/vendor/symfony/config/Resource/ClassExistenceResource.php(76): class_exists('Drupal\\file\\Fil...') #2 /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php(361): Symfony\Component\Config\Resource\ClassExistenceResource->isFresh(0) #3 /var/www/html/vendor/symfony/dependency-injection/Compiler/RegisterAutoconfigureAttributesPass.php(32): Symfony\Component\DependencyInjection\ContainerBuilder->getReflectionClass('Drupal\\file\\Fil...', false) #4 /var/www/html/vendor/symfony/dependency-injection/Compiler/Compiler.php(80): Symfony\Component\DependencyInjection\Compiler\RegisterAutoconfigureAttributesPass->process(Object(Drupal\Core\DependencyInjection\ContainerBuilder)) #5 /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php(767): Symfony\Component\DependencyInjection\Compiler\Compiler->compile(Object(Drupal\Core\DependencyInjection\ContainerBuilder)) #6 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(1447): Symfony\Component\DependencyInjection\ContainerBuilder->compile() #7 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(971): Drupal\Core\DrupalKernel->compileContainer() #8 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(515): Drupal\Core\DrupalKernel->initializeContainer() #9 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(739): Drupal\Core\DrupalKernel->boot() #10 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #11 {main} in /var/www/html/web/core/modules/file/src/FileMigrationDependencyManager.php on line 18
    
  • πŸ‡ΊπŸ‡ΈUnited States agentrickard Georgia (US)

    The MigrationDeriverTrait only has one method.

    Removing the Trait call and moving that method into FileMigrationDependencyManager.php fixes the issue, but I suspect this may affect all uses of the Trait.

    It seems to be a race condition regarding how the plugin alter hook gets called.

Production build 0.71.5 2024