Add tutorial to lesson migration command#3041
Merged
adamwoodnz merged 3 commits intotrunkfrom Nov 27, 2024
Merged
Conversation
pkevan
reviewed
Nov 27, 2024
| * : 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) |
Contributor
There was a problem hiding this comment.
in most cases having a dry-run variable is how it's normally done, but this is a minor nitpick and not a blocker.
pkevan
reviewed
Nov 27, 2024
| */ | ||
| private function process_url( $url, $is_dry_run ) { | ||
| // Get post ID from URL | ||
| $post_id = url_to_postid( $url ); |
Contributor
There was a problem hiding this comment.
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).
pkevan
reviewed
Nov 27, 2024
| $urls = array( $source ); | ||
| } | ||
|
|
||
| foreach ( $urls as $url ) { |
Contributor
There was a problem hiding this comment.
some consideration should be made for memory expensive operations when looping through an indeterminate number of items
pkevan
reviewed
Nov 27, 2024
Contributor
pkevan
left a comment
There was a problem hiding this comment.
most of my comments are minor given the extend of the command being used (less than 100 items)
Contributor
Author
All fair, thanks! |
bazza
pushed a commit
to WordPress/wordpress.org
that referenced
this pull request
Nov 27, 2024
Add CLI script to convert Tutorials to Lessons See WordPress/Learn#3041 git-svn-id: https://meta.svn.wordpress.org/sites/trunk@14214 74240141-8908-4e6f-9713-ba540dce6ec7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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