| 1 | Index: /Users/simon/Projects/WordPress-Bleeding/site/wp-includes/ms-blogs.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- /Users/simon/Projects/WordPress-Bleeding/site/wp-includes/ms-blogs.php (revision 15675) |
|---|
| 4 | +++ /Users/simon/Projects/WordPress-Bleeding/site/wp-includes/ms-blogs.php (working copy) |
|---|
| 5 | @@ -370,6 +370,29 @@ |
|---|
| 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 | + * @uses get_blog_details() If validation is required |
|---|
| 20 | + * @uses $wpdb To change the DB tables being queried |
|---|
| 21 | + * @uses do_action() |
|---|
| 22 | + * @uses did_action() |
|---|
| 23 | + * @uses wp_get_current_user() |
|---|
| 24 | + * @uses wp_cache_init() |
|---|
| 25 | + * @uses wp_cache_add_global_groups() |
|---|
| 26 | + * @uses wp_cache_add_non_persistent_groups() |
|---|
| 27 | + * |
|---|
| 28 | + * @param int $blog_id The ID of the blog/site to switch to |
|---|
| 29 | + * @param bool $validate Whether to check the existence of the blog before switching |
|---|
| 30 | + * @return bool True if the switch was successful, otherwise false |
|---|
| 31 | + **/ |
|---|
| 32 | function switch_to_blog( $new_blog, $validate = false ) { |
|---|
| 33 | global $wpdb, $table_prefix, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache; |
|---|
| 34 | |
|---|
| 35 | @@ -432,6 +455,21 @@ |
|---|
| 36 | return true; |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | +/** |
|---|
| 40 | + * Restores the previous blog (also referred to as a site) that was in use |
|---|
| 41 | + * by WordPress. |
|---|
| 42 | + * |
|---|
| 43 | + * @since 3.0.0 |
|---|
| 44 | + * @uses $wpdb To change the DB tables being queried |
|---|
| 45 | + * @uses do_action() |
|---|
| 46 | + * @uses did_action() |
|---|
| 47 | + * @uses wp_get_current_user() |
|---|
| 48 | + * @uses wp_cache_init() |
|---|
| 49 | + * @uses wp_cache_add_global_groups() |
|---|
| 50 | + * @uses wp_cache_add_non_persistent_groups() |
|---|
| 51 | + * |
|---|
| 52 | + * @return bool True if the restoration has been successful, otherwise false |
|---|
| 53 | + **/ |
|---|
| 54 | function restore_current_blog() { |
|---|
| 55 | global $table_prefix, $wpdb, $blog_id, $switched, $switched_stack, $wp_roles, $wp_object_cache; |
|---|
| 56 | |
|---|