* @return string
*/
function get_blogaddress_by_name( $blogname ) {
- global $current_site;
-
if ( is_subdomain_install() ) {
if ( $blogname == 'main' )
$blogname = 'www';
$url = rtrim( network_home_url(), '/' );
if ( !empty( $blogname ) )
- $url = preg_replace( '|^([^\.]+://)|', '$1' . $blogname . '.', $url );
+ $url = preg_replace( '|^([^\.]+://)|', "\${1}" . $blogname . '.', $url );
} else {
$url = network_home_url( $blogname );
}
}
/**
- * Get a full blog URL, given a domain and a path.
- *
- * @since MU
- *
- * @param string $domain
- * @param string $path
- * @return string
- */
-function get_blogaddress_by_domain( $domain, $path ) {
- if ( is_subdomain_install() ) {
- $url = "http://" . $domain.$path;
- } else {
- if ( $domain != $_SERVER['HTTP_HOST'] ) {
- $blogname = substr( $domain, 0, strpos( $domain, '.' ) );
- $url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path;
- // we're not installing the main blog
- if ( $blogname != 'www.' )
- $url .= $blogname . '/';
- } else { // main blog
- $url = 'http://' . $domain . $path;
- }
- }
- return esc_url( $url );
-}
-
-/**
- * Given a blog's (subdomain or directory) slug, retrieve it's id.
+ * Given a blog's (subdomain or directory) slug, retrieve its id.
*
* @since MU
*
function refresh_blog_details( $blog_id ) {
$blog_id = (int) $blog_id;
$details = get_blog_details( $blog_id, false );
+ if ( ! $details ) {
+ // Make sure clean_blog_cache() gets the blog ID
+ // when the blog has been previously cached as
+ // non-existent.
+ $details = (object) array(
+ 'blog_id' => $blog_id,
+ 'domain' => null,
+ 'path' => null
+ );
+ }
clean_blog_cache( $details );
* @param int $id The blog id
* @param string $option The option key
* @param mixed $value The option value
- * @return bool True on success, false on failrue.
+ * @return bool True on success, false on failure.
*/
function update_blog_option( $id, $option, $value, $deprecated = null ) {
$id = (int) $id;
}
$wpdb->set_blog_id( $new_blog );
- $GLOBALS['table_prefix'] = $wpdb->prefix;
+ $GLOBALS['table_prefix'] = $wpdb->get_blog_prefix();
$prev_blog_id = $GLOBALS['blog_id'];
$GLOBALS['blog_id'] = $new_blog;
$wpdb->set_blog_id( $blog );
$prev_blog_id = $GLOBALS['blog_id'];
$GLOBALS['blog_id'] = $blog;
- $GLOBALS['table_prefix'] = $wpdb->prefix;
+ $GLOBALS['table_prefix'] = $wpdb->get_blog_prefix();
if ( function_exists( 'wp_cache_switch_to_blog' ) ) {
wp_cache_switch_to_blog( $blog );
( $value == 1 ) ? do_action( 'archive_blog', $blog_id ) : do_action( 'unarchive_blog', $blog_id );
elseif ( 'deleted' == $pref )
( $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;
}