[wp-trac] [WordPress Trac] #21459: Cleanup switch_to_blog() and restore_current_blog()

WordPress Trac wp-trac at lists.automattic.com
Wed Oct 3 20:31:32 UTC 2012


#21459: Cleanup switch_to_blog() and restore_current_blog()
----------------------------+---------------------
 Reporter:  ryan            |       Owner:  ryan
     Type:  task (blessed)  |      Status:  closed
 Priority:  normal          |   Milestone:  3.5
Component:  Multisite       |     Version:  3.4.1
 Severity:  normal          |  Resolution:  fixed
 Keywords:  has-patch       |
----------------------------+---------------------

Comment (by nacin):

 Replying to [comment:45 ryan]:
 > Any reason not to use get_current_blog_id() in is_main_site()?
 >
 > And going further, eliminate use of global $current_blog and instead use
 get_blog_details( get_current_blog_id() ) or perhaps a new
 get_current_blog() function.

 The only real purpose of $current_blog is it can be set in sunrise.php and
 then most of ms-settings.php gets skipped.

 I can't think of a reason to not use get_current_blog_id() in
 is_main_site(). I highly doubt someone is relying on it to be ignorant of
 switches.

 I'd like to eliminate $current_blog usage, definitely. We could make it so
 get_blog_details() with no arguments returns the current blog's details,
 forgoing a new function.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21459#comment:47>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list