updated Command\General\ContentDiffMigrator::update_featured_image_ids and Logic\ContentDiffMigrator::update_featured_images
the logic that updated featured image IDs was overly selective about which Posts it should update, and it might not always have updated all featured image IDs in some edge cases. This fixes it for the regular content diff runs.
also added a new helper/fixer command newspack-content-migrator content-diff-update-featured-images-ids which can safely be run on any Newspack site and retrospectively update any leftover featured image IDs. This one is safe to run because all "old_id"=>"new_id"s get saved in DB as postmeta (or in early versions of CDiff just in the logs), and will only update the appropriate post IDs and their thumbnails
Two methods added for getting "old_id"=>"new_id" mapping
Instead of going through logs to get "old_id"=>"new_id", use these two methods to conveniently get them from DB:
Logic\ContentDiffMigrator::get_imported_post_id_mapping_from_db -- gets an array of all Post IDs imported by Content Diff, their "old_id"=>"new_id" from the postmeta
Logic\ContentDiffMigrator::get_imported_attachment_id_mapping_from_db -- gets a list of all Attachments imported by Content Diff, "old_id"=>"new_id" IDs mapping from the postmeta
Changes
Command\General\ContentDiffMigrator::update_featured_image_ids
andLogic\ContentDiffMigrator::update_featured_images
newspack-content-migrator content-diff-update-featured-images-ids
which can safely be run on any Newspack site and retrospectively update any leftover featured image IDs. This one is safe to run because all"old_id"=>"new_id"
s get saved in DB as postmeta (or in early versions of CDiff just in the logs), and will only update the appropriate post IDs and their thumbnailsTwo methods added for getting
"old_id"=>"new_id"
mappingInstead of going through logs to get
"old_id"=>"new_id"
, use these two methods to conveniently get them from DB:Logic\ContentDiffMigrator::get_imported_post_id_mapping_from_db
-- gets an array of all Post IDs imported by Content Diff, their "old_id"=>"new_id" from the postmetaLogic\ContentDiffMigrator::get_imported_attachment_id_mapping_from_db
-- gets a list of all Attachments imported by Content Diff, "old_id"=>"new_id" IDs mapping from the postmeta