Automattic / newspack-custom-content-migrator

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

Add / Simply Guest Author Name Migrator #459

Closed ronchambers closed 6 months ago

ronchambers commented 7 months ago

This PR Adds the general command to migrate (Simply) Guest Author Name plugin authors to CoAuthorsPlus Guest Authors.

Usage: wp newspack-content-migrator migrate-simply-guest-author-names

Output log: SimplyGuestAuthorNameMigrator_cmd_migrate_simply_guest_author_names.log

Required: CoAuthorPlus plugin installed and activated.

Optional Flags: --overwrite-post-gas will overwrite existing GAs on posts (default: do not process posts where GAs are already set).

Notes:

Future todos:


ronchambers commented 7 months ago

FYI: commit https://github.com/Automattic/newspack-custom-content-migrator/pull/459/commits/7fdea37409c40307bcd124f3074e1a0e07d7b0f0 removed much of the reporting that was done specifically for discovery with the first publisher's site. If in the future, a reporting command is needed, refactor the previous code from this commit and make a new "reporting" command or add a --dry-run parameter to the existing command.

ronchambers commented 7 months ago

@iuravic Ready for review. Thanks!

ronchambers commented 7 months ago

No, from what I can tell by examining this first publisher's data, there is only one sfly_guest_author_names postmeta per post:

select post_id, count(*) mycount
from wp_postmeta 
where meta_key = 'sfly_guest_author_names'
group by post_id
having mycount <> 1;

This returned one post, which had two postmeta rows, but both values were blank. So for our initial case, we can assume only one postmeta per post.

But... a single postmeta sfly_guest_author_names may contain a string of multiple authors such as "Jill Doe and Jon Smith". For this initial publisher, a single GA containing a list authors will display no different than their current site whether it's GA or SGAN.

If we do want to break up these "and / &" cases, my recommendation would be to create a separate general use command related to splitting strings into "Known Names" and "Known Suffixes" like we did with a previous publisher. This new command would work off of existing GAs, since the issue of GAs with "and / &" in their names can happen not only during insert, but can exist when Admins just type multiple names into a GA display name input box. It would be nice to have a GA "clean up" script which can parse and divide out GAs and/or combine GAs with differing spellings like "Jill Doe" and "Jill A Doe" (assuming it's the same person). I propose we do this separetly from this PR.

IDEA: look into existing CLI newspack-content-migrator co-authors-split-to-multiple-coauthors

ronchambers commented 6 months ago

TODO: Put a notice: "This does NOT break apart multi-author strings. This command will create a single CAP GA with multiple author names in. Continue??" (y,n)