Closed (fixed)
Project:
Migrate Manifest
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
7 Jun 2018 at 00:16 UTC
Updated:
8 Jul 2020 at 05:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
xurizaemonComment #3
xurizaemonUpdated to account for recent changes - can't see related issue but it related to batches and was committed in dde78ba3523e9548f6789c453e6ab2456def11ee
Comment #4
xurizaemonComment #5
andrewmacpherson commentedReview of patch #3:
drush_log()in the module. Patch #3 has caught all the instances. Good.Drush::logger(), rather than\Drupal::logger(). See pull request #3810 Replace drush_set_error() and drush_log() via Drush::logger() in the Drush repo for examples.drush_set_error(), so we should update that too.I'll post an updated patch soon.
Comment #6
andrewmacpherson commentedPatch #3 also removed a call to
dt(). This seems unnecessary, becausedt()is still present in Drush 10.1 and isn't marked as deprecated.Comment #7
andrewmacpherson commentedThis patch addresses #5 and #6...
Drush::logger()instead ofDrupal::logger().drush_set_error()withDrush::logger()->error(). This is a more urgent issue;drush_set_error()has been removed completely in Drush 10, while the deprecateddrush_log()is still available.dt()removed by patch #3.Drush::logger()was introduced in Drush 8.1.18 - this is higher than Drupal core's current requirement, so I added a conflict key to Migrate Manifest's composer file.I haven't tested this yet, but I have a personal project which I want to use migrate manifest with so I'll test this very soon. (I arrived here because I ran into the problem with
drush_set_error()not being present in Drush 10.)Comment #8
andrewmacpherson commentedComment #9
andrewmacpherson commentedIt also needed a bunch of
usestatements.Comment #10
andrewmacpherson commentedI've encountered another snag. This issue is probably better scoped as compatibility with Drush > 8, than with use of specific logger functions.
MigrateManifestCommandsmakes use ofdrush_invoke_process(), which has been removed in Drush 10 and replaced withDrush::drush()->mustRun()et. al..We could replace the call to
drush_invoke_process()inMigrateManifestCommands, while leaving it in place inmigrate_manifest.drush.incfor Drush 8 use.The snag is that
Drush::drush()isn't available until 9.5, anddrush_invoke_process()isn't available at all in Drush 10. So how can we make this compatible with Drush 9 and Drush 10?I'm guessing we can check
MigrateManifestCommandsto check whether we have Drush 9 or 10, and either calldrush_invoke_process()orDrush::drush()as appropriate. It might be as easy as checkingfunction_exists(), or perhaps there's a Drush-specific approach to this.I'll ask for opinions in the Drush channel on Drupal Slack.
Comment #11
andrewmacpherson commentedI chatted with (Drush maintainer) about this on Slack.
Rather than try to support Drush versions 9 and 10, and try to detect which API functions are needed, it's simpler to require Drush >= 9.7. This was the last minor version prior to Drush 10, and the difference is that Drush 10 just removed the deprecated stuff (I think).
This patch:
drush_invoke_process()with the newerDrush::drush()approach inMigrateManifestCommandsmigrate_manifest.drush.incfile, so Drush 8 is no longer supported.The last point (dropping support for Drush 8) is something the module maintainer needs to decide upon though.
Comment #12
benjifisherI am just trying this out for the first time today, so maybe I am doing something wrong, but when I try
I get the error
Is
drush_get_option()one of the deprecaetd and/or removed functions?I am using drush 10.2.2.
Comment #13
benjifisherAnother issue: when I add the
-v(verbose) flag, I see a lot ofThat looks like a parameter that did not get replaced.
Comment #14
benjifisherAnother thing I get when running
drush -v mm:I am setting the status to NW for this and the comments I made in #12 and #13.
Comment #15
ravimane23 commentedSome errors still exists while making compatible with Drupal 9
drupal-check -d modules/contrib/migrate_manifest
8/8 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
------ ----------------------------------------------------------------
Line src/Commands/MigrateManifestCommands.php
------ ----------------------------------------------------------------
48 Call to deprecated method logger() of class Drush\Drush:
Use injected logger instead.
51 Call to deprecated method aliasManager() of class Drush\Drush:
Use injected alias manager instead. @see Drush::drush()
------ ----------------------------------------------------------------
------ ----------------------------------------------------------
Line src/DrushLogMigrateMessage.php
------ ----------------------------------------------------------
19 Call to deprecated method logger() of class Drush\Drush:
Use injected logger instead.
------ ----------------------------------------------------------
------ ----------------------------------------------------------
Line src/MigrateManifest.php
------ ----------------------------------------------------------
126 Call to deprecated method logger() of class Drush\Drush:
Use injected logger instead.
185 Call to deprecated method logger() of class Drush\Drush:
Use injected logger instead.
------ ----------------------------------------------------------
[ERROR] Found 5 errors
Comment #16
ravimane23 commentedAdded generated patch using "drupal-check" to make it compatible with Drupal 9.
Comment #17
neclimdulThanks everyone.
I don't think this is what the intention was for the deprecation. Also the signature is wrong, core's logger method only takes one argument and returns a service. Also Drush still uses this method pretty heavily so I don't know how big a deal it is. Not sure how I want to fix this yet but I'll fix it on commit shortly.
Comment #19
benjifisherCross-post: I had written the following.
@ravimane23:
Thanks for working on Drupal 9 compatibility. But being compatible with Drupal 9 is different from being compatible with Drush 10.
Please see Creating an interdiff for the recommended ways to create an interdiff.
Using
Drupal::logger()goes against the recommendation in #5. If you think that comment is wrong, then please explain why.I do not think
Drupal::logger()accepts two arguments. Perhaps you mean\Drupal::logger('migrate_manifest')->error($e->getMessage()).In #14, I wrote
but it looks as though I left the status at NR. Let me do that for real now.
I guess I will leave the status unchanged and open a follow-up for #12 and #13. For reference, can you post the patch that was actually committed?
Comment #20
neclimdulSorry about the cross post, that's always frustrating. Glad we're in agreement about the logger changes. Part of this is definitely my fault because in the time since this patch started to now Drush has push things toward Drush::logger() and then also deprecated it and that messes things up. Also harsh, 5 months is some fast moving APIs. :(
I think #12 might have been addressed. I can't find any references to
drush_get_optionFor #13, I haven't tested but the code _looks_ correct. I don't know why Drush's logger wasn't replacing before like its suppose to but Ravi's patch added a dt() around it and I left that in. Please test and let me know if that fixes it or if we need a follow up..
I meant to follow up with an interdiff, esp since the changes ended up being more involved then expected but I got pulled into a meeting and distracted. Obviously you can see the full commit in the linked commit message and the changes from #16 are in this interdiff. Summary, everything gets a logger in the constructor and it uses DrushCommand's logger trait to get the logger(and pass it to the helper classes). I think the biggest change is the migrate message class which has some BC code in the constructor just to be safe and it got a quick test to make sure everything is translated reasonably to Drush's PSR logger. Mostly because 'status' is not a valid PSR log level.
Comment #21
neclimdulSide note, I have mixed feelings about the drush 8 support going away because I'm very aware migrations end up with weird requirements. I couldn't come up for a case where it really made sense though. If someone gets here because they do need it, I'm not appose to adding it back just open an issue and give me a reason :)
Comment #22
benjifisherI should be able to test soon. For now, just to save a few clicks,
Comment #23
neclimdulNote, you'll have to check this in 8.x. Drupal 9 is currently blocked by this. https://www.drupal.org/project/drupal/issues/3154398#comment-13715800