Automattic / Co-Authors-Plus

Multiple bylines and Guest Authors for WordPress
https://wordpress.org/plugins/co-authors-plus/
GNU General Public License v2.0
291 stars 205 forks source link

add: created a new CLI cmd to backfill missing author terms for posts. #1060

Open eddiesshop opened 2 weeks ago

eddiesshop commented 2 weeks ago

Description

This is a new, more efficient, command to help backfill author term data for any posts that are missing it. The new command was based off of the old one. The key differences between that command and this one are:

  1. If, for some reason, the command were to get killed while it was backfilling data, re-running wp co-authors-plus create-terms-for-posts would always start back from the first post. For sites of a certain stature, this could create a situation where this command would never finish executing. Instead, this new command only looks for posts that are missing the requisite author term in the relationships table via SQL.
  2. Since only posts that are missing the author term are pulled, once the missing data is created, any subsequent command execution means that you will be processing a smaller and smaller list of posts that need to be addressed, unlike the existing command.

Deploy Notes

Are there any new dependencies added that should be taken into account when deploying to WordPress.org? No, this is an entirely new command.

Steps to Test

  1. Check out PR.
  2. Take a DB backup.
  3. Execute this command with wp co-authors-plus create-author-terms-for-posts
  4. Once complete, run the old command: wp co-authors-plus create-terms-for-posts. Notice that no new author terms are being created.