Ticket #23155: 23155.diff

File 23155.diff, 1.9 KB (added by ryan, 4 months ago)
Line 
1Index: wp-includes/ms-blogs.php
2===================================================================
3--- wp-includes/ms-blogs.php    (revision 23294)
4+++ wp-includes/ms-blogs.php    (working copy)
5@@ -687,6 +687,8 @@
6                ( $value == 1 ) ? do_action( 'archive_blog', $blog_id ) : do_action( 'unarchive_blog', $blog_id );
7        elseif ( 'deleted' == $pref )
8                ( $value == 1 ) ? do_action( 'make_delete_blog', $blog_id ) : do_action( 'make_undelete_blog', $blog_id );
9+       elseif ( 'public' == $pref )
10+               do_action( 'update_blog_public', $blog_id ); // Moved here from update_blog_public().
11 
12        return $value;
13 }
14Index: wp-includes/general-template.php
15===================================================================
16--- wp-includes/general-template.php    (revision 23294)
17+++ wp-includes/general-template.php    (working copy)
18@@ -1705,8 +1705,22 @@
19  * @since 2.1.0
20  */
21 function noindex() {
22+       $public = get_option( 'blog_public' );
23+
24+       if ( is_multisite() ) {
25+               // Compare local and global and override with the local setting if they
26+               // don't match.
27+
28+               global $current_blog;
29+
30+               if ( ( '' != $public ) && ( $public != $current_blog->public ) ) {
31+                       update_blog_status( get_current_blog_id(), 'public', $public );
32+                       $current_blog->public = $public;
33+               }
34+       }
35+
36        // If the blog is not public, tell robots to go away.
37-       if ( '0' == get_option('blog_public') )
38+       if ( '0' == $public )
39                wp_no_robots();
40 }
41 
42Index: wp-includes/ms-functions.php
43===================================================================
44--- wp-includes/ms-functions.php        (revision 23294)
45+++ wp-includes/ms-functions.php        (working copy)
46@@ -1770,9 +1770,7 @@
47  * @return bool
48  */
49 function update_blog_public( $old_value, $value ) {
50-       global $wpdb;
51-       do_action('update_blog_public');
52-       update_blog_status( $wpdb->blogid, 'public', (int) $value );
53+       update_blog_status( get_current_blog_id(), 'public', (int) $value );
54 }
55 add_action('update_option_blog_public', 'update_blog_public', 10, 2);
56