Problem/Motivation
Drush 12 changes the way it injects services. In #3078507, some refactoring was done to make the Drush commands available in the main module (purge). To make my custom code work (calling \Drupal::service('purge_drush.queue_commands');), I did this naive change of copying all service definitions from drush.services.yml to services.yml and all Drush commands under `src/Drush/Commands`. I also updated the class namespaces in drush.services.yml
Steps to reproduce
Install Drush 12. Notice that the services defined in `drush.services.yml` in the module suddenly don't work.
Proposed resolution
Make Drush commands compatible with Drush 12.
Remaining tasks
None.
User interface changes
None.
API changes
The services in (current) drush.services.yml in the module will be available globally in Drupal.
Data model changes
None.
Issue fork purge-3440974
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
Comment #2
kekkisFixing Version info.
Comment #4
kekkisAn open and honest question in addition to the one in the IS: would we want to opt for auto-wiring instead of adding the create methods? It's the new in, hip and pop thing available in Drush 12.5. At least using
createmethods gives us a little more backwards compatibility.Comment #5
sokru commentedThanks for this! Requested few changes. I suggest we keep compatibility for drush v11.
Comment #6
japerryTo get included in the 8.x-3.x version of purge, it will need to NOT use the autowiring functionality. It appears we will need to roll a new major version of purge to accommodate many issues that have been accumulating over the past few months, but won't happen until after Drupal 11.
Comment #7
kekkis@japerry, I have pushed changes in the MR now. Please review again. As you can see in the comments, I also manually tested with the two combos that IMO make some kind of sense: Drupal 10.1+Drush 11 and Drupal 10.2+Drush 12. But as I wrote this note, I thought of yet another combo that is sensible in some cases: Drupal 10.1 + Drush 12. Here's the output for that test, which also indicates that the combination works ok with the branch:
Comment #8
kekkisUpdated issue summary.
Comment #10
japerryLooks good! Tested against D9, 10, and 11 with Drush 10, 11, and 13. I presume 12 should work inbetween ;)
Committed.