diff --git a/wp-includes/ms-blogs.php b/wp-includes/ms-blogs.php index 90e43d2b6f..de8667bb19 100644 --- a/wp-includes/ms-blogs.php +++ b/wp-includes/ms-blogs.php @@ -1071,6 +1071,49 @@ function get_last_updated( $deprecated = '', $start = 0, $quantity = 40 ) { 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 ); } +/** + * Retrieves network data given a network ID or network object. + * + * Network data will be cached and returned after being passed through a filter. + * If the provided network is empty, the current network global will be used. + * + * @since 4.6.0 + * + * @global WP_Network $current_site + * + * @param WP_Network|int|null $network Network to retrieve. + * @return WP_Network|null The network object or null if not found. + */ +function get_network( &$network = null ) { + global $current_site; + if ( empty( $network ) && isset( $current_site ) ) { + $network = $current_site; + } + + if ( $network instanceof WP_Network ) { + $_network = $network; + } elseif ( is_object( $network ) ) { + $_network = new WP_Network( $network ); + } else { + $_network = WP_Network::get_instance( $network ); + } + + if ( ! $_network ) { + return null; + } + + /** + * Fires after a network is retrieved. + * + * @since 4.6.0 + * + * @param WP_Network $_network Network data. + */ + $_network = apply_filters( 'get_network', $_network ); + + return $_network; +} + /** * Handler for updating the blog date when a post is published or an already published post is changed. * diff --git a/wp-includes/version.php b/wp-includes/version.php index fa3498955d..b4ab4511ff 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.6-alpha-37892'; +$wp_version = '4.6-alpha-37893'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.