WordPress.org

Make WordPress Core

Ticket #41507: 41507.1.diff

File 41507.1.diff, 5.8 KB (added by sathyapulse, 23 months ago)
  • wp-admin/includes/ms.php

     
    785785 *
    786786 * @since 3.1.0
    787787 *
    788  * @global wpdb $wpdb WordPress database abstraction object.
    789  *
    790788 * @param int $site_id The network/site ID to check.
    791789 * @return bool True if network can be edited, otherwise false.
    792790 */
    793791function can_edit_network( $site_id ) {
    794         global $wpdb;
    795 
    796         if ( $site_id == $wpdb->siteid )
     792        if ( $site_id == get_current_network_id() )
    797793                $result = true;
    798794        else
    799795                $result = false;
  • wp-includes/ms-blogs.php

     
    10911091        if ( ! empty( $deprecated ) )
    10921092                _deprecated_argument( __FUNCTION__, 'MU' ); // never used
    10931093
    1094         return $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' AND last_updated != '0000-00-00 00:00:00' ORDER BY last_updated DESC limit %d, %d", $wpdb->siteid, $start, $quantity ) , ARRAY_A );
     1094        return $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' AND last_updated != '0000-00-00 00:00:00' ORDER BY last_updated DESC limit %d, %d", get_current_network_id(), $start, $quantity ) , ARRAY_A );
    10951095}
    10961096
    10971097/**
  • wp-includes/ms-deprecated.php

     
    187187        _deprecated_function( __FUNCTION__, '3.0.0', 'wp_get_sites()' );
    188188
    189189        global $wpdb;
    190         $blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", $wpdb->siteid), ARRAY_A );
     190        $blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", get_current_network_id()), ARRAY_A );
    191191
    192192        $blog_list = array();
    193193        foreach ( (array) $blogs as $details ) {
     
    430430        global $wpdb;
    431431
    432432        if ( ! $sitedomain )
    433                 $site_id = $wpdb->siteid;
     433                $site_id = get_current_network_id();
    434434        else
    435435                $site_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->site WHERE domain = %s AND path = %s", $sitedomain, $path ) );
    436436
     
    447447 * @deprecated 4.6.0 Use get_sites()
    448448 * @see get_sites()
    449449 *
    450  * @global wpdb $wpdb WordPress database abstraction object.
    451  *
    452450 * @param array $args {
    453451 *     Array of default arguments. Optional.
    454452 *
     
    468466 *               values for whether the site is public, archived, mature, spam, and/or deleted.
    469467 */
    470468function wp_get_sites( $args = array() ) {
    471         global $wpdb;
    472 
    473469        _deprecated_function( __FUNCTION__, '4.6.0', 'get_sites()' );
    474470
    475471        if ( wp_is_large_network() )
     
    476472                return array();
    477473
    478474        $defaults = array(
    479                 'network_id' => $wpdb->siteid,
     475                'network_id' => get_current_network_id(),
    480476                'public'     => null,
    481477                'archived'   => null,
    482478                'mature'     => null,
  • wp-includes/ms-functions.php

     
    6969                $ret = false;
    7070                if ( is_array( $blogs ) && count( $blogs ) > 0 ) {
    7171                        foreach ( (array) $blogs as $blog_id => $blog ) {
    72                                 if ( $blog->site_id != $wpdb->siteid )
     72                                if ( $blog->site_id != get_current_network_id() )
    7373                                        continue;
    7474                                $details = get_site( $blog_id );
    7575                                if ( is_object( $details ) && $details->archived == 0 && $details->spam == 0 && $details->deleted == 0 ) {
     
    10611061                return array( 'user_id' => $user_id, 'password' => $password, 'meta' => $meta );
    10621062        }
    10631063
    1064         $blog_id = wpmu_create_blog( $signup->domain, $signup->path, $signup->title, $user_id, $meta, $wpdb->siteid );
     1064        $blog_id = wpmu_create_blog( $signup->domain, $signup->path, $signup->title, $user_id, $meta, get_current_network_id() );
    10651065
    10661066        // TODO: What to do if we create a user but cannot create a blog?
    10671067        if ( is_wp_error($blog_id) ) {
  • wp-includes/option.php

     
    223223                return;
    224224
    225225        if ( empty($site_id) )
    226                 $site_id = $wpdb->siteid;
     226                $site_id = get_current_network_id();
    227227
    228228        $core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled', 'ms_files_rewriting' );
    229229
  • wp-signup.php

     
    354354 *                   The function halts all execution if the user is not logged in.
    355355 */
    356356function validate_another_blog_signup() {
    357         global $wpdb, $blogname, $blog_title, $errors, $domain, $path;
     357        global $blogname, $blog_title, $errors, $domain, $path;
    358358        $current_user = wp_get_current_user();
    359359        if ( ! is_user_logged_in() ) {
    360360                die();
     
    422422         */
    423423        $meta = apply_filters( 'add_signup_meta', $meta_defaults );
    424424
    425         $blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid );
     425        $blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, get_current_network_id() );
    426426
    427427        if ( is_wp_error( $blog_id ) ) {
    428428                return false;