Changeset 43654 for trunk/src/wp-includes/ms-deprecated.php
- Timestamp:
- 09/24/2018 03:08:32 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ms-deprecated.php
r43548 r43654 581 581 return $site_id; 582 582 } 583 584 /** 585 * Install an empty blog. 586 * 587 * Creates the new blog tables and options. If calling this function 588 * directly, be sure to use switch_to_blog() first, so that $wpdb 589 * points to the new blog. 590 * 591 * @since MU (3.0.0) 592 * @deprecated 5.0.0 593 * 594 * @global wpdb $wpdb 595 * @global WP_Roles $wp_roles 596 * 597 * @param int $blog_id The value returned by wp_insert_site(). 598 * @param string $blog_title The title of the new site. 599 */ 600 function install_blog( $blog_id, $blog_title = '' ) { 601 global $wpdb, $wp_roles; 602 603 _deprecated_function( __FUNCTION__, '5.0.0' ); 604 605 // Cast for security 606 $blog_id = (int) $blog_id; 607 608 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 609 610 $suppress = $wpdb->suppress_errors(); 611 if ( $wpdb->get_results( "DESCRIBE {$wpdb->posts}" ) ) { 612 die( '<h1>' . __( 'Already Installed' ) . '</h1><p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p></body></html>' ); 613 } 614 $wpdb->suppress_errors( $suppress ); 615 616 $url = get_blogaddress_by_id( $blog_id ); 617 618 // Set everything up 619 make_db_current_silent( 'blog' ); 620 populate_options(); 621 populate_roles(); 622 623 // populate_roles() clears previous role definitions so we start over. 624 $wp_roles = new WP_Roles(); 625 626 $siteurl = $home = untrailingslashit( $url ); 627 628 if ( ! is_subdomain_install() ) { 629 630 if ( 'https' === parse_url( get_site_option( 'siteurl' ), PHP_URL_SCHEME ) ) { 631 $siteurl = set_url_scheme( $siteurl, 'https' ); 632 } 633 if ( 'https' === parse_url( get_home_url( get_network()->site_id ), PHP_URL_SCHEME ) ) { 634 $home = set_url_scheme( $home, 'https' ); 635 } 636 } 637 638 update_option( 'siteurl', $siteurl ); 639 update_option( 'home', $home ); 640 641 if ( get_site_option( 'ms_files_rewriting' ) ) { 642 update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" ); 643 } else { 644 update_option( 'upload_path', get_blog_option( get_network()->site_id, 'upload_path' ) ); 645 } 646 647 update_option( 'blogname', wp_unslash( $blog_title ) ); 648 update_option( 'admin_email', '' ); 649 650 // remove all perms 651 $table_prefix = $wpdb->get_blog_prefix(); 652 delete_metadata( 'user', 0, $table_prefix . 'user_level', null, true ); // delete all 653 delete_metadata( 'user', 0, $table_prefix . 'capabilities', null, true ); // delete all 654 } 655 656 /** 657 * Set blog defaults. 658 * 659 * This function creates a row in the wp_blogs table. 660 * 661 * @since MU (3.0.0) 662 * @deprecated MU 663 * @deprecated Use wp_install_defaults() 664 * 665 * @global wpdb $wpdb WordPress database abstraction object. 666 * 667 * @param int $blog_id Ignored in this function. 668 * @param int $user_id 669 */ 670 function install_blog_defaults( $blog_id, $user_id ) { 671 global $wpdb; 672 673 _deprecated_function( __FUNCTION__, 'MU' ); 674 675 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 676 677 $suppress = $wpdb->suppress_errors(); 678 679 wp_install_defaults( $user_id ); 680 681 $wpdb->suppress_errors( $suppress ); 682 }
Note: See TracChangeset
for help on using the changeset viewer.