| 1 | Index: wp-includes/ms-blogs.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/ms-blogs.php (revision 15675) |
|---|
| 4 | +++ wp-includes/ms-blogs.php (working copy) |
|---|
| 5 | @@ -370,6 +370,23 @@ |
|---|
| 6 | wp_cache_set( $id."-".$key."-blog_option", $value, 'site-options'); |
|---|
| 7 | } |
|---|
| 8 | |
|---|
| 9 | +/** |
|---|
| 10 | + * Switches the blog (also referred to as a site) currently in use |
|---|
| 11 | + * by WordPress. |
|---|
| 12 | + * |
|---|
| 13 | + * Beware: If you are running a WP Object cache you may find some |
|---|
| 14 | + * options retain their values from the old blog, you could hook |
|---|
| 15 | + * the switch_blog action and delete or switch caches to |
|---|
| 16 | + * address this. |
|---|
| 17 | + * |
|---|
| 18 | + * @since 3.0.0 |
|---|
| 19 | + * |
|---|
| 20 | + * @param int $blog_id The ID of the blog/site to switch to |
|---|
| 21 | + * @param bool $validate Whether to check the existence of the blog before switching |
|---|
| 22 | + * @uses get_blog_details() If validation is required |
|---|
| 23 | + * @uses $wpdb To change the DB tables being queried |
|---|
| 24 | + * @return bool True if the switch was successful, otherwise false |
|---|
| 25 | + **/ |
|---|
| 26 | function switch_to_blog( $new_blog, $validate = false ) { |
|---|
| 27 | global $wpdb, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache; |
|---|
| 28 | |
|---|
| 29 | @@ -432,6 +449,15 @@ |
|---|
| 30 | return true; |
|---|
| 31 | } |
|---|
| 32 | |
|---|
| 33 | +/** |
|---|
| 34 | + * Restores the previous blog (also referred to as a site) that was in use |
|---|
| 35 | + * by WordPress. |
|---|
| 36 | + * |
|---|
| 37 | + * @since 3.0.0 |
|---|
| 38 | + * |
|---|
| 39 | + * @uses $wpdb To change the DB tables being queried |
|---|
| 40 | + * @return bool True if the restoration has been successful, otherwise false |
|---|
| 41 | + **/ |
|---|
| 42 | function restore_current_blog() { |
|---|
| 43 | global $table_prefix, $wpdb, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache; |
|---|
| 44 | |
|---|