create_new_site returning false - replaced insert_blog with wp_insert_site#95
Open
simondw wants to merge 2 commits into10up:masterfrom
Open
create_new_site returning false - replaced insert_blog with wp_insert_site#95simondw wants to merge 2 commits into10up:masterfrom
simondw wants to merge 2 commits into10up:masterfrom
Conversation
Member
|
@simondw looks like there are a couple test failures, mind taking a look at those to see if your PR might need to account for something there? |
nicholasio
requested changes
Jul 23, 2021
Member
nicholasio
left a comment
There was a problem hiding this comment.
This looks good, just left one small comment.
Did all the tests pass locally for you? There are two failing but they seem unrelated.
Member
|
@simondw any thoughts on the questions above? |
Co-authored-by: Nícholas André <nicholasio.oliveira@gmail.com>
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.
Description of the Change
Replaced deprecated function
insert_blog()withwp_insert_site().When running
wp mu-migration import allwithout passing a value for--blog_id,create_new_site()returnedfalse. This update returns the ID of a newly created site and also creates the site.Error received:
PHP Deprecated: insert_blog is <strong>deprecated</strong> since version 5.1.0! Use wp_insert_site() instead. in .../functions.php on line 4861Benefits
This fix uses the WP replacement for
wp_insert_site(),wp_insert_site()which also returns an int for the ID of the newly created site: https://developer.wordpress.org/reference/functions/wp_insert_site/ . This should simply replace a deprecated function (which is no longer working when testing with WP v5.7.2).Possible Drawbacks
The array defined as $new_site_meta var includes predefined values for public, archived, mature, etc. These could present a problem if a migration originates from a multisite. My use test case was for a single site origin.
Verification Process
Manually running and local unit tests; have not pushed any new tests with this update.
Checklist: