[wp-trac] [WordPress Trac] #37102: Replace get_blog_details with get_site

WordPress Trac noreply at wordpress.org
Fri Sep 30 18:57:59 UTC 2016


#37102: Replace get_blog_details with get_site
--------------------------------+--------------------------
 Reporter:  spacedmonkey        |       Owner:  iamfriendly
     Type:  task (blessed)      |      Status:  assigned
 Priority:  normal              |   Milestone:  4.7
Component:  Networks and Sites  |     Version:  4.6
 Severity:  normal              |  Resolution:
 Keywords:  has-patch           |     Focuses:  multisite
--------------------------------+--------------------------

Comment (by iamfriendly):

 `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()` and `array_shift()`
 * Already in 37102.1.patch but I think we should do individual patches
 * No unit tests
 * 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:

 ----

 === 03. ./wp-admin/ms-delete-site.php:27: `$blog = get_blog_details();`
 ===

 * Not within a function/method
 * Recommendation: `get_sites()` and `array_shift()`
 * No unit tests
 * `$blog` is only used within a confirmation message on line 88
 * 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:

 ----

 === 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:

 ----

 === 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:

 ----

 === 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:

 ----

 === 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:

 ----

 === 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:

 ----

 === 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:

 ----

 === 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:

 ----

 === 12. ./wp-includes/class-wp-xmlrpc-server.php:4376: `$current_blog =
 get_blog_details();` ===

 * within `wp_xmlrpc_server::_multisite_getUsersBlogs();`
 * Recommendation: `get_sites()` and `array_shift()`
 * No unit tests
 * Ticket:

 ----

 === 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()`
 and `test_get_blogaddress_by_id_with_invalid_id()`)
 * Ticket:

 ----

 === 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:

 ----

 === 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:

 ----

 === 16. ./wp-includes/ms-blogs.php:1040: `$details = get_blog_details(
 $id, false );` ===

 * within `get_blog_status()`
 * Recommendation: `get_site()`
 * No unit tests
 * Ticket:

 ----

 === 17. ./wp-includes/ms-deprecated.php:29: `return get_blog_details(
 $blog );` ===

 * within (deprecated) `get_dashboard_blog()`
 * Recommendation: `get_site()` (I _think_ the `dashboard_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:

 ----

 === 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:

 ----

 === 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:

 ----

 === 20. ./wp-includes/ms-functions.php:58: `$primary = get_blog_details(
 $primary_blog );` ===

 * within `get_active_blog_for_user()`
 * Recommendation: `get_site()` (I _think_ the `primary_blog` user meta is
 a site ID)
 * No unit tests
 * Could be combined with 19
 * Ticket:

 ----

 === 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:

 ----

 === 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:

 ----

 === 23. ./wp-includes/ms-load.php:87: `$blog = get_blog_details();` ===

 * within `ms_site_check()`
 * Recommendation: `get_sites()` and `array_shift()`
 * No unit tests
 * Ticket:

 ----

 === 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:

 ----

 === 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:

 ----

 === 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:

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37102#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list