-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Drush 8 discover my new drush 9 command file as well. #3041
Comments
TL;DNR UPDATE: Don't use These issues need to be addressed.
Drush has provided backwards-compatible execution of the old-style Drush commands from Drush 2 through Drush 8. We should plan for a similar long run for the new mechanism to run from Drush 8 through many future versions major version upgrades of Drush. |
I cant reproduce this. Please post your full module so we can try to reproduce. For example, I enabled devel module and its submodule devel_generate. Then I ran some Drush commands using the Drush8 phar. I am seeing that the new Drush9 commandfiles get loaded. You mention annotationcommand_adapter_get_discovery(). That is only in play before full bootstrap. Commandfiles that belong to modules get loaded via a drush.services.yml file, and not via that filesystem discovery. I think you you should try to package your commandfile not as a module but rather as a composer package. If that sounds hard, just commit it to /drush in your composer project or even sites/all/drush in your drupal directory. |
Currently I'm trying to port the acsf module but now I don't have anything shareable, but I could reproduce the problem with SandwichCommands.php as well. |
Please don't ever point --include at a module. Thats not needed or supported. Drush loads from enabled modules automatically. |
For porting, see https://weitzman.github.io/blog/port-to-drush9. |
The main use case we are concerned about right now is modules with drush.services.yml. If you have a ported module that is causing problems with Drush 8, please provide a repository URL for reproduction. |
I figured this one out. In Drush 9, you are supposed to put your command services in the file Drush 8 never implemented drush.services.yml, but it will read command files out of services.yml. I think we should either remove services.yml commandfile handling from Drush 8 -- something that I don't think anyone used -- or also implement drush.services.yml and ensure there is some way for commandfiles to express Drush version compatibility. |
I think 'neither' is a viable option too. if very few people used the services.yml approach in Drupal 8, then there isn't much of a problem. Those people are blissfully using Drush8 and we would bother them with such a change. I'd be up for more docs about how this is a bad idea or a deprecated idea. |
Tentatively closing this. |
We should put in additional safeguards at a minimum. There is potential for conflict between sitewide commands (DRUPAL_ROOT/drush). Folks can manage their own global locations tho. |
Is this true or false? I've definitely thought I knew the answer in both directions several times while reading various issue threads. Thanks! |
The answer is more subtle than true/false question. See #2787 (comment) |
(I can't tell whether it's better to reply here or there (#2787); I picked over there, b/c over there seemed like a broader thread about overall Drupal 8.4 + drush compatability -- but seriously was mostly a guess; if this is a better place for my reply, please please say so and I'll re-post here and delete/strikethrough my other one.) |
I think we'll go with 'do nothing' for now. |
We absolutely need a way for folks to be able to write a Drush-9-only commandfile and put it in DRUPAL_ROOT/drush & have it not crash Drush 8 (and visa-versa). The rest is optional. |
Fixed by #3189 |
I ported my drush command set to be drush 9 compatible, my module just only contains a drush command set so it isn't a real module. So every time if somebody wants to use it, he/she needs to run with drush -r {docroot} -i {docroot/module/mymodule}.
My new command file is working with drush 9, but I wanted to test my module with drush 8 as well.
The drush failed with PHP error: PHP Fatal error: Class 'Drush\Commands\DrushCommands' not found
because the annotationcommand_adapter_get_discovery() method finds my commands class but it's using class which isn't available in drush 8.
I tested with drush 8.1.14
The text was updated successfully, but these errors were encountered: