Problem/Motivation

Drush 12+ is now supported, it should be moved up to that version only. The previous issue #2955644: Implement WordPress Migrate with Drush 9/10 was not completed for older drush versions but everyone who worked on it would be credited for this one as well.

Also note a similar module has a better drush integration currently, may be helpful: https://www.drupal.org/project/wordpress_migrate_sql

Remaining tasks

  • remove old wordpress_migrate.drush.inc file
  • implement new drush version, restoring the wordpress:migrate-generate command
  • update Readme.md

User interface changes

Different drush arguments potentially.

API changes

Drush base version change.

Data model changes

Should not be any.

CommentFileSizeAuthor
#9 drush.diff5.31 KBxpete
Command icon 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

hongpong created an issue. See original summary.

hongpong’s picture

Issue summary: View changes
hongpong’s picture

Issue summary: View changes

  • hongpong committed d2998fcf on 8.x-3.x
    Issue #3489516 "Remove broken Drush 8 file, Update README.md"
    
ressa’s picture

Issue summary: View changes

It looks like a task can be struck from this issue, since the old wordpress_migrate.drush.inc file was removed.

Can the patch from #2955644-12: Implement WordPress Migrate with Drush 9/10 be transferred to this issue as an MR? Or are the changes in Drush 13 too big, and it needs a total rewrite?

Also, perhaps the Issue Summary could get an update since this doesn't seem correct: "Drush 12+ is now supported"

ressa’s picture

Issue summary: View changes

I spotted the Drush command drush wordpress:migrate-generate in the patch file in the other issue, which I added to the Issue Summary ... I hope it's correct?

Generating a WordPress migration entirely via Drush, instead of via the GUI, would be a really cool feature to have.

hongpong’s picture

It is a great question, I haven't made or updated drush commands in a minute. You are probably looking in the right spot. the boilerplate in Drush definitely change over the years. for one thing it uses new style php attributes instead of annotations https://mglaman.dev/blog/writing-drush-commands-php-attributes

apparently we should use the autowire trait and not the drush.services.yml - https://www.drush.org/13.x/commands/ - https://github.com/drush-ops/drush/blob/13.x/src/Commands/AutowireTrait.php

i asked the claude bot about drush 9 vs 12 or 13 and it gave me this; https://claude.ai/share/e41bca21-d38d-498c-9818-c17b286642d4

Thanks for your interest in re addressing this, it is a very good idea.

regarding this migrateGenerate function i think it could pack its user command line settings into an $opts array or other parameters to pass, trigger one of the WordpressMigrate functions and hand over the $opts in one parameter, as opposed to configuring more elements of the migration objects in the drush function directly. (this keeping the drush lighter.)

( I was looking at doing this in #3173973: Pluggable extension, support contrib + custom WordPress, Yoast SEO for some parts of the migration process with the new pluggability extension system. ) Ideally a new drush would match the custom steps in #3173973 , potentially with new command line options. it could read a JSON to set options for extensions, or other nice features like that. (this keeping the drush extensible)

I think all of that would be ideal, but if we cannot get for instance the pluggable part, i would still be ok to commit something as better than nothing.

xpete’s picture

StatusFileSize
new5.31 KB

Attached is a new implementation of the drush command. The implementation is based on the already existing one and the drush documentation. https://www.drush.org/13.x/commands/

ressa’s picture

Status: Active » Needs review

Thanks @xpete! The new method is to use GitLab MR's (it supports test, better reviewing, etc.) so I created a new branch based on your diff.

ressa changed the visibility of the branch 3489516-implement-drush-12 to hidden.

xpete’s picture

Great! Thanks. Btw, no AI was used in the making of that code.

hongpong’s picture

Brilliant work and really helpful, the human expertise applied!! The only report on the MR pipeline was that

Major - \Drupal calls should be avoided in classes, use dependency injection instead
in src/Drush/Commands/WordpressMigrateCommands.php:61
in src/Drush/Commands/WordpressMigrateCommands.php:85
in src/Plugin/migrate/process/LogTerm.php:47

Sorry to not review this sooner, I haven't had the time to get at the volunteer work lately.

  • hongpong committed 2b840931 on 8.x-3.x authored by ressa
    Resolve #3489516 by xpete, ressa, HongPong. Add Drush 13 support....
hongpong’s picture

Title: Implement Drush 12+ on wordpress_migrate » Implement Drush 13+ on wordpress_migrate
Assigned: Unassigned » hongpong
Status: Needs review » Fixed
Issue tags: +drush-13

OK I did a little more sanity checking in the migration generator and other various things. Thanks for carrying the torch on all this. I think it is fairly robust now.

Updated Readme. WordPressMigrationGenerator: catch unset base_url, duplicate migration groups, broken file_uri. Removed NEXT_MAJOR from gitlab-ci

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

ressa’s picture

Thank you @xpete and @hongpong, this is great news and a positive Drupal experience, which is always nice :)

We all totally understand that you are busy elsewhere @hongpong, I am just very grateful that you maintain and expand this great contrib module on a regular basis. And now, let's celebrate the release of 8.x-3.0-alpha8 today! 🎉

PS. As a positive side effect, a lot of the text under the sections "Now Drupal 10 compatible" and "Dependencies" on https://www.drupal.org/project/wordpress_migrate can be removed.

hongpong’s picture

Thank you ressa :) I cleaned up the landing page a ways today. Time flies!!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.