Make WordPress Core

Ticket #14953: switch_to_blog and restore_current_blog inline docs.diff

File switch_to_blog and restore_current_blog inline docs.diff, 1.5 KB (added by simonwheatley, 15 years ago)

Go on then, I'll bite: docs for switch_to_blog (inc beware, see #14992) and restore_current_blog

  • wp-includes/ms-blogs.php

     
    370370        wp_cache_set( $id."-".$key."-blog_option", $value, 'site-options');
    371371}
    372372
     373/**
     374 * Switches the blog (also referred to as a site) currently in use
     375 * by WordPress.
     376 *
     377 * Beware: If you are running a WP Object cache you may find some
     378 * options retain their values from the old blog, you could hook
     379 * the switch_blog action and delete or switch caches to
     380 * address this.
     381 *
     382 * @since 3.0.0
     383 *
     384 * @param int $blog_id The ID of the blog/site to switch to
     385 * @param bool $validate Whether to check the existence of the blog before switching
     386 * @uses get_blog_details() If validation is required
     387 * @uses $wpdb To change the DB tables being queried
     388 * @return bool True if the switch was successful, otherwise false
     389 **/
    373390function switch_to_blog( $new_blog, $validate = false ) {
    374391        global $wpdb, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache;
    375392
     
    432449        return true;
    433450}
    434451
     452/**
     453 * Restores the previous blog (also referred to as a site) that was in use
     454 * by WordPress.
     455 *
     456 * @since 3.0.0
     457 *
     458 * @uses $wpdb To change the DB tables being queried
     459 * @return bool True if the restoration has been successful, otherwise false
     460 **/
    435461function restore_current_blog() {
    436462        global $table_prefix, $wpdb, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache;
    437463