-
Notifications
You must be signed in to change notification settings - Fork 100
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
Add tutorial to lesson migration command #3041
base: trunk
Are you sure you want to change the base?
Conversation
* : The URL of the tutorial post to convert, or path to a file containing URLs (one per line) | ||
* | ||
* [--live] | ||
* : Actually perform the conversion (default is dry-run) |
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.
in most cases having a dry-run
variable is how it's normally done, but this is a minor nitpick and not a blocker.
*/ | ||
private function process_url( $url, $is_dry_run ) { | ||
// Get post ID from URL | ||
$post_id = url_to_postid( $url ); |
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.
url_to_postid
is an expensive operation, so it should be considered if running through a large amount of items (which I think this instance isn't).
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.
TIL
$urls = array( $source ); | ||
} | ||
|
||
foreach ( $urls as $url ) { |
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.
some consideration should be made for memory expensive operations when looping through an indeterminate number of items
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.
most of my comments are minor given the extend of the command being used (less than 100 items)
All fair, thanks! |
See #2393
Closes #3043
Adds a CLI command to mu-plugins for converting tutorials to lessons, by changing the post type. Takes a single post URL, or file with a list of URLs, which will be created from this sheet.
By default runs in dry mode, which prints the details of the post(s).
I plan to update the sync script to copy this into
wporg/public_html/wp-content/mu-plugins/pub