Make WordPress Core


Ignore:
Timestamp:
10/01/2015 10:09:18 PM (9 years ago)
Author:
johnbillion
Message:

Deprecate create_empty_blog(). This function has never been used in core.

Fixes #34120

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-deprecated.php

    r33676 r34753  
    357357    return esc_url_raw( $url );
    358358}
     359
     360/**
     361 * Create an empty blog.
     362 *
     363 * @since MU 1.0
     364 * @deprecated 4.4.0
     365 *
     366 * @param string $domain       The new blog's domain.
     367 * @param string $path         The new blog's path.
     368 * @param string $weblog_title The new blog's title.
     369 * @param int    $site_id      Optional. Defaults to 1.
     370 * @return string|int The ID of the newly created blog
     371 */
     372function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) {
     373    _deprecated_function( __FUNCTION__, '4.4' );
     374
     375    if ( empty($path) )
     376        $path = '/';
     377
     378    // Check if the domain has been used already. We should return an error message.
     379    if ( domain_exists($domain, $path, $site_id) )
     380        return __( '<strong>ERROR</strong>: Site URL already taken.' );
     381
     382    // Need to back up wpdb table names, and create a new wp_blogs entry for new blog.
     383    // Need to get blog_id from wp_blogs, and create new table names.
     384    // Must restore table names at the end of function.
     385
     386    if ( ! $blog_id = insert_blog($domain, $path, $site_id) )
     387        return __( '<strong>ERROR</strong>: problem creating site entry.' );
     388
     389    switch_to_blog($blog_id);
     390    install_blog($blog_id);
     391    restore_current_blog();
     392
     393    return $blog_id;
     394}
Note: See TracChangeset for help on using the changeset viewer.