WordPress.org

Make WordPress Core

Changeset 34753


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

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

Fixes #34120

Location:
trunk/src/wp-includes
Files:
2 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}
  • trunk/src/wp-includes/ms-functions.php

    r34676 r34753  
    295295
    296296    return true;
    297 }
    298 
    299 /**
    300  * Create an empty blog.
    301  *
    302  * @since MU 1.0
    303  *
    304  * @param string $domain       The new blog's domain.
    305  * @param string $path         The new blog's path.
    306  * @param string $weblog_title The new blog's title.
    307  * @param int    $site_id      Optional. Defaults to 1.
    308  * @return string|int The ID of the newly created blog
    309  */
    310 function create_empty_blog( $domain, $path, $weblog_title, $site_id = 1 ) {
    311     if ( empty($path) )
    312         $path = '/';
    313 
    314     // Check if the domain has been used already. We should return an error message.
    315     if ( domain_exists($domain, $path, $site_id) )
    316         return __( '<strong>ERROR</strong>: Site URL already taken.' );
    317 
    318     // Need to back up wpdb table names, and create a new wp_blogs entry for new blog.
    319     // Need to get blog_id from wp_blogs, and create new table names.
    320     // Must restore table names at the end of function.
    321 
    322     if ( ! $blog_id = insert_blog($domain, $path, $site_id) )
    323         return __( '<strong>ERROR</strong>: problem creating site entry.' );
    324 
    325     switch_to_blog($blog_id);
    326     install_blog($blog_id);
    327     restore_current_blog();
    328 
    329     return $blog_id;
    330297}
    331298
Note: See TracChangeset for help on using the changeset viewer.