]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-includes/ms-load.php
WordPress 4.7-scripts
[autoinstalls/wordpress.git] / wp-includes / ms-load.php
index 9fbaa5fa0d253e5ff7f97ee516e00f58a7b0c25b..cf564990cccfd1b974febeaa452ec3e81e063fa0 100644 (file)
@@ -84,7 +84,7 @@ function ms_site_check() {
        if ( is_super_admin() )
                return true;
 
-       $blog = get_blog_details();
+       $blog = get_site();
 
        if ( '1' == $blog->deleted ) {
                if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) )
@@ -97,7 +97,7 @@ function ms_site_check() {
                if ( file_exists( WP_CONTENT_DIR . '/blog-inactive.php' ) ) {
                        return WP_CONTENT_DIR . '/blog-inactive.php';
                } else {
-                       $admin_email = str_replace( '@', ' AT ', get_site_option( 'admin_email', 'support@' . get_current_site()->domain ) );
+                       $admin_email = str_replace( '@', ' AT ', get_site_option( 'admin_email', 'support@' . get_network()->domain ) );
                        wp_die(
                                /* translators: %s: admin email link */
                                sprintf( __( 'This site has not been activated yet. If you are having problems activating your site, please contact %s.' ),
@@ -134,35 +134,24 @@ function get_network_by_path( $domain, $path, $segments = null ) {
 }
 
 /**
- * Retrieve an object containing information about the requested network.
- *
- * @since 3.9.0
- *
- * @internal In 4.6.0, converted to use get_network()
+ * Retrieves the closest matching site object by its domain and path.
+ * 
+ * This will not necessarily return an exact match for a domain and path. Instead, it
+ * breaks the domain and path into pieces that are then used to match the closest
+ * possibility from a query.
  *
- * @param object|int $network The network's database row or ID.
- * @return WP_Network|false Object containing network information if found, false if not.
- */
-function wp_get_network( $network ) {
-       $network = get_network( $network );
-       if ( null === $network ) {
-               return false;
-       }
-
-       return $network;
-}
-
-/**
- * Retrieve a site object by its domain and path.
+ * The intent of this method is to match a site object during bootstrap for a
+ * requested site address
  *
  * @since 3.9.0
+ * @since 4.7.0 Updated to always return a `WP_Site` object.
  *
  * @global wpdb $wpdb WordPress database abstraction object.
  *
  * @param string   $domain   Domain to check.
  * @param string   $path     Path to check.
  * @param int|null $segments Path segments to use. Defaults to null, or the full path.
- * @return object|false Site object if successful. False when no site is found.
+ * @return WP_Site|false Site object if successful. False when no site is found.
  */
 function get_site_by_path( $domain, $path, $segments = null ) {
        $path_segments = array_filter( explode( '/', trim( $path, '/' ) ) );
@@ -205,21 +194,24 @@ function get_site_by_path( $domain, $path, $segments = null ) {
         *
         * @since 3.9.0
         *
-        * @param null|bool|object $site     Site value to return by path.
-        * @param string           $domain   The requested domain.
-        * @param string           $path     The requested path, in full.
-        * @param int|null         $segments The suggested number of paths to consult.
-        *                                   Default null, meaning the entire path was to be consulted.
-        * @param array            $paths    The paths to search for, based on $path and $segments.
+        * @param null|bool|WP_Site $site     Site value to return by path.
+        * @param string            $domain   The requested domain.
+        * @param string            $path     The requested path, in full.
+        * @param int|null          $segments The suggested number of paths to consult.
+        *                                    Default null, meaning the entire path was to be consulted.
+        * @param array             $paths    The paths to search for, based on $path and $segments.
         */
        $pre = apply_filters( 'pre_get_site_by_path', null, $domain, $path, $segments, $paths );
        if ( null !== $pre ) {
+               if ( false !== $pre && ! $pre instanceof WP_Site ) {
+                       $pre = new WP_Site( $pre );
+               }
                return $pre;
        }
 
        /*
         * @todo
-        * get_blog_details(), caching, etc. Consider alternative optimization routes,
+        * caching, etc. Consider alternative optimization routes,
         * perhaps as an opt-in for plugins, rather than using the pre_* filter.
         * For example: The segments filter can expand or ignore paths.
         * If persistent caching is enabled, we could query the DB for a path <> '/'
@@ -251,7 +243,6 @@ function get_site_by_path( $domain, $path, $segments = null ) {
        $site = array_shift( $result );
 
        if ( $site ) {
-               // @todo get_blog_details()
                return $site;
        }
 
@@ -542,3 +533,26 @@ function wpmu_current_site() {
        _deprecated_function( __FUNCTION__, '3.9.0' );
        return $current_site;
 }
+
+/**
+ * Retrieve an object containing information about the requested network.
+ *
+ * @since 3.9.0
+ * @deprecated 4.7.0 Use `get_network()`
+ * @see get_network()
+ *
+ * @internal In 4.6.0, converted to use get_network()
+ *
+ * @param object|int $network The network's database row or ID.
+ * @return WP_Network|false Object containing network information if found, false if not.
+ */
+function wp_get_network( $network ) {
+       _deprecated_function( __FUNCTION__, '4.7.0', 'get_network()' );
+
+       $network = get_network( $network );
+       if ( null === $network ) {
+               return false;
+       }
+
+       return $network;
+}