Fire the update_blog_public action from update_blog_status() instead of update_blog_public(). Pass blog ID and value to the action.

Add code to noindex() to sync the 'public' value in the site options table with the blog_public value in the options table.

fixes #23155


git-svn-id: http://core.svn.wordpress.org/trunk@23794 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ryan Boren 2013-03-25 09:29:58 +00:00
parent 8eea008b2c
commit 0f304375f9
3 changed files with 18 additions and 4 deletions

View File

@ -1703,8 +1703,22 @@ function wlwmanifest_link() {
* @since 2.1.0 * @since 2.1.0
*/ */
function noindex() { function noindex() {
$public = get_option( 'blog_public' );
if ( is_multisite() ) {
// Compare local and global and override with the local setting if they
// don't match.
global $current_blog;
if ( ( '' != $public ) && ( $public != $current_blog->public ) ) {
update_blog_status( get_current_blog_id(), 'public', $public );
$current_blog->public = $public;
}
}
// If the blog is not public, tell robots to go away. // If the blog is not public, tell robots to go away.
if ( '0' == get_option('blog_public') ) if ( '0' == $public )
wp_no_robots(); wp_no_robots();
} }

View File

@ -695,6 +695,8 @@ function update_blog_status( $blog_id, $pref, $value, $deprecated = null ) {
( $value == 1 ) ? do_action( 'archive_blog', $blog_id ) : do_action( 'unarchive_blog', $blog_id ); ( $value == 1 ) ? do_action( 'archive_blog', $blog_id ) : do_action( 'unarchive_blog', $blog_id );
elseif ( 'deleted' == $pref ) elseif ( 'deleted' == $pref )
( $value == 1 ) ? do_action( 'make_delete_blog', $blog_id ) : do_action( 'make_undelete_blog', $blog_id ); ( $value == 1 ) ? do_action( 'make_delete_blog', $blog_id ) : do_action( 'make_undelete_blog', $blog_id );
elseif ( 'public' == $pref )
do_action( 'update_blog_public', $blog_id, $value ); // Moved here from update_blog_public().
return $value; return $value;
} }

View File

@ -1734,9 +1734,7 @@ function is_user_spammy( $user_login = null ) {
* @return bool * @return bool
*/ */
function update_blog_public( $old_value, $value ) { function update_blog_public( $old_value, $value ) {
global $wpdb; update_blog_status( get_current_blog_id(), 'public', (int) $value );
do_action('update_blog_public');
update_blog_status( $wpdb->blogid, 'public', (int) $value );
} }
add_action('update_option_blog_public', 'update_blog_public', 10, 2); add_action('update_option_blog_public', 'update_blog_public', 10, 2);