Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore Drush\Drupal\Commands\sql\SanitizePluginInterface #6018

Closed
jcnventura opened this issue May 31, 2024 · 0 comments · Fixed by #6019
Closed

Restore Drush\Drupal\Commands\sql\SanitizePluginInterface #6018

jcnventura opened this issue May 31, 2024 · 0 comments · Fixed by #6019

Comments

@jcnventura
Copy link

Describe the bug
Many contrib modules extend SanitizePluginInterface in their Drush commands. The move of Drush\Drupal\Commands\sql\SanitizePluginInterface to Drush\Commands\sql\sanitize\SanitizePluginInterface will force many modules to create a version of the command for Drush 12 and before and another for Drush 13.

This would normally be easy to solve with the use of drush.services.yml, but from what I understand, this is also being removed in Drush 13. In theory, one could maybe create a new command for Drush <=12, and use drush.services.yml for that, but how does one prevent that Drush 13 also loads that command?

I believe the best option is to restore the Drush\Drupal\Commands\sql\SanitizePluginInterface file, just making it an empty shell for the new interface, and this could be eventually be removed when Drupal 10 reaches end-of-life, and support for Drush 11 and 12 can be dropped from modules. The interface should be marked for deprecation until Drupal 12 (and I guess Drush 15 is out).

To Reproduce
Tried to run a module that extends SanitizePluginInterface in Drupal 11.

Expected behavior
Module would run.

Actual behavior
Got the following: [error] Error: Interface "Drush\Drupal\Commands\sql\SanitizePluginInterface" not found in include() (line 18 of /data/app/modules/contrib/webform/src/Commands/WebformSanitizeSubmissionsCommands.php) #0 /data/vendor/composer/ClassLoader.php(576): include()

Workaround
Is there a way to do conditional use statements in PHP?

System Configuration

Q A
Drush version? 13.x
Drupal version? 11.x
PHP version 8.3
OS? Linux

Additional information
See https://www.drupal.org/project/webform/issues/3445590 (and probably many, many others will soon follow)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant