Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Drush 9 introduces an entirely new format for commands, and stops supporting the long-standing (plugin).drush.inc after 9.0.0-beta4, so the commands need to be ported to the new format.
Comment | File | Size | Author |
---|---|---|---|
#31 | drush_language-convert_drush_9-2914081-31.patch | 158.21 KB | Grimreaper |
#3 | 2914081-drush9.patch | 21.92 KB | fgm |
Comments
Comment #2
fgmhttps://github.com/dawehner/drush_language/pull/18
Comment #3
fgmIn patch format for review here.
Comment #4
fgmComment #5
GrimreaperHello,
I am trying to apply your patch, but the commands are not detected.
My project structure is as follow:
- drush/commands/drush_language
- src/core, etc.
- composer.json
- bin (from composer)
- vendor
I tried creating a drush.yml config file into the drush folder at the root of my project, the drush config file is detected by drush when I run drush status.
I tried putting in the drush.yml:
After clearing caches each time, I can't see the command when running Drush.
Does drush_language needs to be in a specific folder?
Thanks for any help.
Comment #6
GrimreaperSorry, I didn't take attention to the new README.md file...
Comment #7
GrimreaperOk. I got error on PHP 5.6 environment I will upload an updated patch.
Comment #8
GrimreaperHere is the updated patch and the interdiff.
Thanks for the review.
Comment #9
fgmI would rather drop PHP 5.6 than drop the type hints, wouldn't you too ? (and add a php: 7.0 in the .info.yml file)
Otherwise:
That was my original version, but drupalcs complains with that indent, and doesn't complain when the ?: are in position 6 instead of 8.
Comment #10
GrimreaperHello,
As I have projects at work and personal (Drupalfr site) that are on PHP 5.6, I would prefer the code to support PHP 5.6. Also Drupal 8 Core is compatible with PHP 5.6.
Yes, I would prefer having all the Drupal projects on Earth on PHP 7 but I can't control that :).
About the indentation, sorry I didn't particularly mean to change that, just changes from the IDE when copy pasting.
Comment #11
fgmOtherwise, it's good for me, but I can't RTBC it since it wrote too much of it.
Comment #12
fgmJust noticed this warning on one site when using it, although it actually works in the end:Happens with all po files, not just Ctools'.Was not related, but came from elsewhere in the project.
Comment #13
geek-merlinGreat you work on this!! No time today for a thorough review, but a quick shot: Did you read this:
http://nuvole.org/blog/2017/oct/13/how-maintain-drush-commands-drush-8-a...
It would save us forking a new version, and i'd love to commit it that way if feasible...
Comment #14
fgmYes, that sounds good, but IMHO this is best left for a followup, as it involves refactoring the code, while this patch mostly doesn't affect the Drush 8 operation: the only changes in the .drush.inc are spelling and comments.
Better keep the patch minimal to have a working version for everyone, and only then refactor if there is still a point in keeping Drush 8, and to also possibly make it easier to support console.
Comment #15
egruel CreditAttribution: egruel commentedHello,
I test patch #8 it's good for me.
Comment #16
fgm@grimreaper food for thought about 5.6 https://www.drupal.org/project/drupal/issues/2842431 it's going to be dropped next year, in 8.6.0 anyway.
Comment #17
Grimreaper@fgm: Thank you very much for the link.
Comment #18
geek-merlinGreat you hacked this together and can use it. As stated in #13 for inclusion this needswork.
Comment #19
geek-merlinComment #20
geek-merlinComment #21
fgmThe current PR head at https://github.com/dawehner/drush_language/pull/18 now includes the latest Drush 9 requirements for a composer.json section.
Comment #22
geek-merlin#13 elaborated: As a maintainer, i see the issue that this patch will introduce code duplicated in 2 places which makes any subsequent patch cumbersome and error-prone. Fortunately the config-split guys have solved that problem well and - even better - documented their effort. It's super simple!
So if this patch is reworked that way, we can move it in.
Comment #23
GrimreaperComment #24
GrimreaperHere is a patch from the PR https://github.com/dawehner/drush_language/pull/18 last version applied on the drupal.org git repository last dev version.
I will try to create the service and make the factorisation. Hope it will be merged...
Comment #25
GrimreaperI will push the commits into https://github.com/FlorentTorregrosa/drush_language.
And will notify when it will be ready.
Comment #26
GrimreaperI am still working on that.
But that's interesting to note that in D8, languages does not have "status" anymore (and no more "languages" database table). But the module still has disable and enable methods. I think its has not been used/tested.
I will remove its.
Comment #27
GrimreaperStill working on this. I am currently testing.
As the default site language is in the simple config "system.site". I think the default language command also didn't work.
Comment #28
GrimreaperManual tests ok for Drush 9.
For Drush 8: "No hook functions were found for language-default." => no one use the default language command.
Comment #29
GrimreaperManual tests ok for me on Drush 9 and Drush 8.
Please see https://github.com/FlorentTorregrosa/drush_language for the changes.
It would be nice to preserve the different commits. Sorry I have not do that for @fgm works. But if you want I can prepare a branch with the detail of @fgm commits and mine applied on top of that.
Thanks for the review.
And hoping it will be merged before Drush 8 command will move again!!!
Comment #30
geek-merlinBonjour Florent,
great that you have been working on this. And great you're providing a git multipatchfile, which makes this monster reviewable.
I did a first review, and everything looks thorough. Also i noticed you removed some weirdesses from different origins.
And obsoleted commands: good catch.
> For Drush 8: "No hook functions were found for language-default." => no one use the default language command.
Interesting find.
I'd say let's go all the way and add the console wrapper. So setting needswork.
* isAbsolutePath() is for free, just require webmozart/path-util in our composer.json (we must do this anyway to not rely on other project's implementation details) and change the condition slightly
* The batch should work too as console commands run in booted drupal. (or did you test?)
Comment #31
GrimreaperGuten Tag Axel :),
Thanks for your review!
About the drush batch process, I don't currently now how to make it with Drupal console, so it needs work. I will ping the Drupal console team for a little help and opinion if they are interested with those commands.
Comment #32
GrimreaperPing in the Drupal console community done: https://gitter.im/hechoendrupal/DrupalConsole?at=5a895380a2194eb80d7be4a6
I have just looked at the current Drupal console commands, and there is already a "locale:language:add" and the default language command can be done with a command to change the config and a cache clear. (For Drush, it can also be done that way)
So the only commands interesting for Drupal console would be the import and export of translations.
Comment #33
GrimreaperHello,
@axel.rutz: no response from the Drupal console community in a week. Do you want to wait more?
Also increasing the priority because if other issues lands in Drush language it will make the work done here unusable or needing to adjust again.
I think we can merge the work done here now without closing the issue for Drupal console support if needed. To avoid patches on other issues to cancel the work done here or in the opposite way to prevent other people working on other issues.
I have just saw the other issues and people are also fixing what will be fixed here (#2873380: No hook functions were found for language-default, #2873379: No hook functions were found for language-enable).
Comment #35
geek-merlinYeah, in fact you addressed 1), and i guess 2) should just work. And if not, we'll do a followup.
Committed, merged and release a RC1!
😍 THanks a lot! 😍
Comment #36
geek-merlinComment #37
GrimreaperThanks for the commits.
\o/
Comment #38
GrimreaperDeleting my mirror on Github as the commits have been merged and this issue is fixed.
Comment #39
fgmI archived mine, and suggest you do the same if you haven't already deleted yours, to avoid breaking the sites who could depend on yours the very week 8.5.0 got released.
Would be nice if @daniel wehner did the same for his own.
Comment #40
Grimreaper@fgm: oups, already deleted my repository. I had put in the description that my repository was only there the time this issue is resolved. As I don't use regularly the "archive" feature of Github I didn't think about this option. Sorry, you are right, I could have broken websites... My bad.