Automattic / newspack-custom-content-migrator

Custom migration tasks for launching and migrating Newspack sites on Atomic
5 stars 5 forks source link

Use CAP logic class from migration tools repo instead #521

Closed naxoc closed 1 month ago

naxoc commented 2 months ago

This pretty agressively deprecates the NewspackCustomContentMigrator\Logic\CoAuthorPlus class in favor of the class now in the re-usable migration tools repo. The aggressive deprecation is on purpose so we don't work in two places. The class in the new repo is a 1:1 of the class I'm deprecating in this repo, so this PR is not about checking if the new class will work – but about it being included correctly.

What I've done is just change the inclusion of the class to the new class. It's a lot of code to review, but it should be possible to do with a glance.

I've tested in a bunch of ways – even with the unit tests (they are broken without this PR, but this PR does not break them even more).

How to test

Ideally you test this with something you are working on currently – so "actual" migration code that uses the class. But here are some ideas if you don't have that kind of code laying around:

wp newspack-content-migrator co-authors-link-guest-author-to-existing-user --ga_id=<guest-user-id> --user_id=<user-id>
wp newspack-content-migrator co-authors-create-guest-author-and-add-to-post --post-id=$(wp post list --orderby=ID --order=desc --posts_per_page=1 --format=ids) --full_name='Gary BorkBorkzy'