The 'file_exists' configuration is not working as expected on Drupal 10.3.0 and above

The 'file_exists' configuration is not working as expected due to the fact that the FileSystemInterface::EXISTS_ERROR as well as
FileSystemInterface::EXISTS_RENAME and FileSystemInterface::EXISTS_REPLACE are deprecated from Drupal 10.3.0

In fact, if I set 'file_exists' to "use_existing", the file is still being replaced because the FileProcessBase plugin uses FileExists::Error instead of FileSystemInterface::EXISTS_ERROR. The same thing applies to "rename".

Steps to reproduce

1. Given a migration that uses the image_import plugin
2. Set the 'file_exists' configuration to 'use existing' as it is suggested in the documentation
3. Execute the migration
4. If if the file already exists it is always downloaded and replaced

This causes performance issues.

Proposed resolution

A proposed solution is to replace the deprecated constants with the newer way of working.

Remaining tasks

A patch to be submitted.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

nikolabintev created an issue. See original summary.

nikolabintev’s picture

StatusFileSize
new2.31 KB

Please find the uploaded patches that solved the issue.

nikolabintev’s picture

Status: Needs work » Needs review
jsacksick’s picture

Status: Needs review » Needs work

The problem is, doing this means dropping support for Drupal core versions prior to 10.3... which is probably not desired...
See https://www.drupal.org/node/3426517.

Unless the maintainer's plan is to introduce a new major version?

nikolabintev’s picture

Yes, this is what's need to be done. We need a new major version that supports Drupal 10.3 and 11

drclaw’s picture

Version: 2.0.x-dev » 3.0.x-dev
Status: Needs work » Fixed

I concur! Created a new 3.0.x branch and applied this patch. Changed core version requirements to ^10.3 || ^11.

🙏

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.