public static function get_instance($site_id)
    {
        global $wpdb;

        $site_id = (int) $site_id;
        if (! $site_id) {
            return false;
        }

        $_site = wp_cache_get($site_id, 'sites');

        if (! $_site) {
            $_site = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->blogs} WHERE blog_id = %d LIMIT 1", $site_id));

            if (empty($_site) || is_wp_error($_site)) {
                return false;
            }

            wp_cache_add($site_id, $_site, 'sites');
        }

        return new WP_Site($_site);
    }
public static function get_instance($site_id)
    {
        global $wpdb;

        $site_id = (int) $site_id;
        if (! $site_id) {
            return false;
        }

        $_site = wp_cache_get($site_id, 'sites');

        if (! $_site) {
            $_site = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->blogs} WHERE blog_id = %d LIMIT 1", $site_id));

            if (empty($_site) || is_wp_error($_site)) {
                return false;
            }

            wp_cache_add($site_id, $_site, 'sites');
        }

        return new WP_Site($_site);
    }
public static function get_instance ( $ site_id ) { global $ wpdb ; $ site_id = ( int ) $ site_id ; if ( ! $ site_id ) { return false ; } $ _site = wp_cache_get ( $ site_id , 'sites' ) ; if ( ! $ _site ) { $ _site = $ wpdb -> get_row ( $ wpdb -> prepare ( "SELECT * FROM {$wpdb->blogs} WHERE blog_id = %d LIMIT 1" , $ site_id ) ) ; if ( empty ( $ _site ) || is_wp_error ( $ _site ) ) { return false ; } wp_cache_add ( $ site_id , $ _site , 'sites' ) ; } return new WP_Site ( $ _site ) ; }
Retrieves a site from the database by its ID.

@static
@since 4.5.0

@global wpdb $wpdb WordPress database abstraction object.

@param int $site_id The ID of the site to retrieve.
@return WP_Site|false The site's object if found. False if not.
Retrieves a site from the database by its ID .