-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bulk Migration Support via WP CLI #70
Conversation
'post_type' => $post_type, | ||
'post_status' => 'publish', | ||
'fields' => 'ids', | ||
'posts_per_page' => -1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would need to be updated to be a paginated loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dsawardekar if you agree on ^ this, mind a quick update to make that update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dkotter @faisal-alvi looking to one of you to give this a review from the OSP perspective, please and thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, it worked:
But I have noticed a couple of things:
- It also runs through the posts which do not have classic editor content. Would be very efficient in performance and time savior if we only loop through the classic editor posts.
- If the post is empty, the 'Classic Editor' mark remains as is, even after the migration is completed. For example, please see the post "test2" below:
Also, ran the phpcs
check and found the following errors in multiple places, so just pointing here:
- Short array syntax is not allowed.
- Parameter comment must end with a full stop, exclamation marks, or question marks.
A question: can we pass a CPT slug in the CLI command to convert its posts?
And, just a few minor suggestions are posted below.
$progress_bar->tick(); | ||
|
||
$prev_progress = 0; | ||
$ticks = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A minor alignment required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
@faisal-alvi I ran
The only way to accurately check if a post has blocks is to check its post_content for the Gutenberg preamble, The PR has the cc @jeffpaul |
Co-authored-by: Faisal Alvi <faisalalvi33@gmail.com>
Description of the Change
This PR adds support for bulk migration of classic editor posts to Gutenberg Blocks. The implementation provides a WP CLI command to start and monitor the progress of the migration. When started the CLI outputs a link that must be opened in a browser window. The browser window will convert classic editor content to blocks and then move on to the next post, and so forth until all posts are converted. Posts that are already converted to blocks are skipped.
The following screencast shows this in action.
Closes #56
Verification Process
To verify this you need a WordPress database with classic editor content. Then run the WP CLI as follows. The CLI will output a URL that needs to be opened in the Browser. (You should be logged in to the WordPress before hand.)
I've tested this on a recent production migration with <1000 posts. Larger migrations are also possible but will take longer to complete.
Checklist:
Changelog Entry
Added - WP CLI based bulk migration support
Credits
Props @dsawardekar