#37102 closed task (blessed) (fixed)
Replace get_blog_details with get_site
Reported by: | spacedmonkey | Owned by: | jeremyfelt |
---|---|---|---|
Milestone: | 4.7 | Priority: | normal |
Severity: | normal | Version: | 4.6 |
Component: | Networks and Sites | Keywords: | has-patch has-dev-note |
Focuses: | multisite | Cc: |
Description (last modified by )
Currently there are lots of calls to the get_blog_details
function. Now that get_site
is in place, we should place that with the new function. Only calls that get the site by id can be replaced.
Attachments (3)
Change History (42)
#2
@
8 years ago
@flixos90 my first patch only replaces code that doesn't require any of the none standard wp_site properties, like blogname.
This ticket was mentioned in Slack in #core-multisite by spacedmonkey. View the logs.
8 years ago
#4
@
8 years ago
In WP_Importer class uses get_blog_details. 37102.1.patch replaces it with get_sites.
This ticket was mentioned in Slack in #core-multisite by spacedmonkey. View the logs.
8 years ago
#7
@
8 years ago
- Milestone changed from Awaiting Review to 4.6
Moving this to the 4.6 milestone to see what progress we can make over the next few days. Most likely there will be many uses that we aren't able to get replaced properly until 4.7.
Anywhere that we replace get_blog_details()
with get_site()
should ideally have tests that pass before and after. It will make sense to create individual tickets for many of these replacements.
This ticket was mentioned in Slack in #core by ocean90. View the logs.
8 years ago
#9
@
8 years ago
- Keywords 4.7-early added
- Milestone changed from 4.6 to Future Release
After discussing status during beta 1 bug scrub tonight, I'm pushing this back to future release. There's a lot to do and a lot of unit tests to get right before swapping things out.
Let's pick it up in 4.7-early. I'm in favor of individual tickets for many of these. Ticket containing description of how get_blog_details()
is used in the function, tests or confirmation of tests for the function, and the replacement.
This ticket was mentioned in Slack in #core-multisite by spacedmonkey. View the logs.
8 years ago
#11
@
8 years ago
- Keywords 4.7-early removed
- Milestone changed from Future Release to 4.7
- Owner set to jeremyfelt
- Status changed from new to accepted
- Type changed from enhancement to task (blessed)
Let's start working on this.
Repeating:
"Anywhere that we replace get_blog_details()
with get_site()
should ideally have tests that pass before and after. It will make sense to create individual tickets for many of these replacements."
This ticket was mentioned in Slack in #core by desrosj. View the logs.
8 years ago
#13
@
8 years ago
Anyone able to make some progress on this? Per bugscrub chat, it will most likely span a few releases, but for the start to make 4.7, we need to get to work on it.
This ticket was mentioned in Slack in #core-multisite by flixos90. View the logs.
8 years ago
#15
@
8 years ago
- Owner changed from jeremyfelt to iamfriendly
- Status changed from accepted to assigned
This ticket was mentioned in Slack in #core-multisite by richardtape. View the logs.
8 years ago
#17
@
8 years ago
get_blog_details()
occurrences in core.
Found by running grep -rnw . -e "get_blog_details("
I've added recommendations for each replacement based on what params (if any) are passed to get_blog_details()
Also placed an empty bullet point on each one for a ticket number so that we're able to track the overall progress in this ticket, but each replacement should have its own ticket (a couple can be combined).
01. ./wp-admin/includes/class-wp-importer.php:141: $blog = get_blog_details( array( 'domain' => $parsed['host'], 'path' => $parsed['path'] ) );
- within
WP_Importer::set_blog()
- Recommendation:
get_sites()
andarray_shift()
- Already in 37102.1.patch but I think we should do individual patches
- No unit tests
- Ticket: 38345 https://core.trac.wordpress.org/ticket/38345#ticket
02. ./wp-admin/includes/ms.php:69: $blog = get_blog_details( $blog_id );
- within
wpmu_delete_blog()
- Recommendation:
get_site()
wpmu_delete_blog()
is referenced multiple times in unit tests- Ticket: https://core.trac.wordpress.org/ticket/38346
03. ./wp-admin/ms-delete-site.php:27: $blog = get_blog_details();
- Not within a function/method
- Recommendation:
get_site()
- No unit tests
$blog
is only used within a confirmation message on line 88- Ticket: 38347 https://core.trac.wordpress.org/ticket/38347#ticket
04. ./wp-admin/my-sites.php:26: $blog = get_blog_details( (int) $_POST['primary_blog'] );
- Not within a function/method
- Recommendation:
get_site()
- No unit tests
- Ticket: https://core.trac.wordpress.org/ticket/38348
05. ./wp-admin/network/site-info.php:44: $details = get_blog_details( $id );
- Not within a function/method
- Recommendation:
get_site()
- No unit tests
- Ticket: 38349 https://core.trac.wordpress.org/ticket/38349
06. ./wp-admin/network/site-info.php:91: $existing_details = get_blog_details( $id, false );
- Not within a function/method
- Recommendation:
get_site()
- No unit tests
- Ticket: 38349 https://core.trac.wordpress.org/ticket/38349
07. ./wp-admin/network/site-info.php:104: $new_details = get_blog_details( $id, false );
- Not within a function/method
- Recommendation:
get_site()
- No unit tests
- Ticket: 38349 https://core.trac.wordpress.org/ticket/38349
08. ./wp-admin/network/site-settings.php:41: $details = get_blog_details( $id );
- Not within a function/method
- Recommendation:
get_site()
- No unit tests
- Ticket: 38349 https://core.trac.wordpress.org/ticket/38349
09. ./wp-admin/network/site-themes.php:64: $details = get_blog_details( $id );
- Not within a function/method
- Recommendation:
get_site()
- No unit tests
- Ticket: 38349 https://core.trac.wordpress.org/ticket/38349
10. ./wp-admin/network/site-users.php:57: $details = get_blog_details( $id );
- Not within a function/method
- Recommendation:
get_site()
- No unit tests
- Ticket: 38349 https://core.trac.wordpress.org/ticket/38349
11. ./wp-admin/network/sites.php:97: $site_details = get_blog_details( $id );
- Not within a function/method
- Recommendation:
get_site()
- No unit tests
- Ticket: 38349 https://core.trac.wordpress.org/ticket/38349
12. ./wp-includes/class-wp-xmlrpc-server.php:4376: $current_blog = get_blog_details();
- within
wp_xmlrpc_server::_multisite_getUsersBlogs();
- Recommendation:
get_sites()
andarray_shift()
- No unit tests
- Ticket: https://core.trac.wordpress.org/ticket/38350
13. ./wp-includes/ms-blogs.php:41: $bloginfo = get_blog_details( (int) $blog_id );
- within
get_blogaddress_by_id()
- Recommendation:
get_site()
- Multiple unit tests (i.e.
test_get_blogaddress_by_id_with_valid_id()
andtest_get_blogaddress_by_id_with_invalid_id()
) - Ticket: 38351 https://core.trac.wordpress.org/ticket/38351
14. ./wp-includes/ms-blogs.php:267: $details = get_blog_details( $blog_id, false );
- within
refresh_blog_details()
- Recommendation:
get_site()
- No unit tests (and neither does
clean_blog_cache()
also used within that function - possibly a good first bug) - Ticket: 38351 https://core.trac.wordpress.org/ticket/38351
15. ./wp-includes/ms-blogs.php:311: $current_details = get_blog_details($blog_id, false);
- within
update_blog_details()
- Recommendation:
get_site()
- Has suite of unit tests in
Tests_Multisite_Update_Blog_Details
- Ticket: 38351 https://core.trac.wordpress.org/ticket/38351
16. ./wp-includes/ms-blogs.php:1040: $details = get_blog_details( $id, false );
- within
get_blog_status()
- Recommendation:
get_site()
- No unit tests
- Ticket: 38351 https://core.trac.wordpress.org/ticket/38351
17. ./wp-includes/ms-deprecated.php:29: return get_blog_details( $blog );
- within (deprecated)
get_dashboard_blog()
- Recommendation:
get_site()
(I _think_ thedashboard_blog
site option is a site ID) - Has unit test
test_get_dashboard_blog()
- When updating, would we also update braces on the conditional and yoda condition (even though this is deprecated)?
- Could be combined with 18
- Ticket: 38354 https://core.trac.wordpress.org/ticket/38354
18. ./wp-includes/ms-deprecated.php:31: return get_blog_details( get_current_site()->blog_id );
- within (deprecated)
get_dashboard_blog()
- Recommendation:
get_site()
- Has unit test
test_get_dashboard_blog()
- Could be combined with 17
- Ticket: 38354 https://core.trac.wordpress.org/ticket/38354
19. ./wp-includes/ms-functions.php:56: $primary = get_blog_details( $first_blog->userblog_id );
- within
get_active_blog_for_user()
- Recommendation:
get_site()
- No unit tests
- Could be combined with 20
- Ticket: https://core.trac.wordpress.org/ticket/38355
20. ./wp-includes/ms-functions.php:58: $primary = get_blog_details( $primary_blog );
- within
get_active_blog_for_user()
- Recommendation:
get_site()
(I _think_ theprimary_blog
user meta is a site ID) - No unit tests
- Could be combined with 19
- Ticket: https://core.trac.wordpress.org/ticket/38355
21. ./wp-includes/ms-functions.php:74: $details = get_blog_details( $blog_id );
- within
get_active_blog_for_user()
- Recommendation:
get_site()
- No unit tests
- Ticket: https://core.trac.wordpress.org/ticket/38355
22. ./wp-includes/ms-functions.php:164: $details = get_blog_details($blog_id);
- within
add_user_to_blog()
- Recommendation:
get_site()
- No unit tests
- Ticket: https://core.trac.wordpress.org/ticket/38356
23. ./wp-includes/ms-load.php:87: $blog = get_blog_details();
- within
ms_site_check()
- Recommendation:
get_sites()
andarray_shift()
- No unit tests
- Ticket: https://core.trac.wordpress.org/ticket/38357
24. ./wp-includes/user.php:624: $blog = get_blog_details( 1 );
- within
get_blogs_of_user()
- Recommendation:
get_site()
- Has unit test
test_get_blogs_of_user()
- Could be combined with 25
- Ticket: https://core.trac.wordpress.org/ticket/38358
25. ./wp-includes/user.php:654: $blog = get_blog_details( $blog_id );
- within
get_blogs_of_user()
- Recommendation:
get_site()
- Has unit test
test_get_blogs_of_user()
- Could be combined with 24
- Ticket: https://core.trac.wordpress.org/ticket/38358
26. ./wp-includes/user.php:722: $blog = get_blog_details( $blog_id );
- within
is_user_member_of_blog()
- Recommendation:
get_site()
- Has unit test
test_is_user_member_of_blog()
- Ticket: https://core.trac.wordpress.org/ticket/38358
This ticket was mentioned in Slack in #core-multisite by jeremyfelt. View the logs.
8 years ago
This ticket was mentioned in Slack in #core-multisite by flixos90. View the logs.
8 years ago
This ticket was mentioned in Slack in #core-multisite by jeremyfelt. View the logs.
8 years ago
#21
@
8 years ago
- Description modified (diff)
We made some great progress today in this discussion on Slack and created several new tickets to encourage incremental progress.
I'd like to keep this ticket attached to the 4.7 milestone until the enhancements deadline on October 26 to continue to encourage eyes on the individual tickets. We can then bring it back to the 4.8 milestone once that is created.
This ticket was mentioned in Slack in #core by jeffpaul. View the logs.
8 years ago
This ticket was mentioned in Slack in #core by jeremyfelt. View the logs.
8 years ago
This ticket was mentioned in Slack in #core-multisite by jeremyfelt. View the logs.
8 years ago
#33
@
8 years ago
Remaining items:
- Deprecate
blog_details
filter. #38491. - Adjust any documentation that may be confusing and refers to
get_blog_details()
. That can happen on this ticket.
#34
@
8 years ago
- Owner changed from iamfriendly to jeremyfelt
- Status changed from assigned to reviewing
#36
@
8 years ago
37102.diff adjusts inline documentation referring to get_blog_details()
.
This ticket was mentioned in Slack in #core-multisite by jeremyfelt. View the logs.
8 years ago
#39
@
4 years ago
- Keywords has-dev-note added
Linking the dev note that was published here for reference: https://make.wordpress.org/core/2016/11/04/multisite-focused-changes-in-4-7/
Reminder: We can only start replacing
get_blog_details()
when #36935 is in place.