Changeset 27663 for trunk/src/wp-includes/ms-settings.php
- Timestamp:
- 03/24/2014 12:13:48 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ms-settings.php
r27406 r27663 68 68 /* 69 69 * A "subdomain" install can be re-interpreted to mean "can support any domain". 70 * If we're not dealing with one of these installs, then the important part is determin g70 * If we're not dealing with one of these installs, then the important part is determining 71 71 * the network first, because we need the network's path to identify any sites. 72 72 */ … … 109 109 } 110 110 111 // If we don't have a network by now, we have a problem.111 // No network has been found, bail. 112 112 if ( empty( $current_site ) ) { 113 113 ms_not_installed(); 114 } 115 116 // @todo Investigate when exactly this can occur. 117 if ( empty( $current_blog ) && defined( 'WP_INSTALLING' ) ) { 118 $current_blog = new stdClass; 119 $current_blog->blog_id = $blog_id = 1; 120 } 121 122 // No site has been found, bail. 123 if ( empty( $current_blog ) ) { 124 // We're going to redirect to the network URL, with some possible modifications. 125 $scheme = is_ssl() ? 'https' : 'http'; 126 $destination = "$scheme://{$current_site->domain}{$current_site->path}"; 127 128 /** 129 * Fires when a network can be determined but a site cannot. 130 * 131 * At the time of this action, the only recourse is to redirect somewhere 132 * and exit. If you want to declare a particular site, do so earlier. 133 * 134 * @since 3.9.0 135 * 136 * @param object $current_site The network that had been determined. 137 * @param string $domain The domain used to search for a site. 138 * @param string $path The path used to search for a site. 139 */ 140 do_action( 'ms_site_not_found', $current_site, $domain, $path ); 141 142 if ( is_subdomain_install() && ! defined( 'NOBLOGREDIRECT' ) ) { 143 // For a "subdomain" install, redirect to the signup form specifically. 144 $destination .= 'wp-signup.php?new=' . str_replace( '.' . $current_site->domain, '', $domain ); 145 } elseif ( is_subdomain_install() ) { 146 // For a "subdomain" install, the NOBLOGREDIRECT constant 147 // can be used to avoid a redirect to the signup form. 148 // Using the ms_site_not_found action is preferred to the constant. 149 if ( '%siteurl%' !== NOBLOGREDIRECT ) { 150 $destination = NOBLOGREDIRECT; 151 } 152 } elseif ( 0 === strcasecmp( $current_site->domain, $domain ) ) { 153 /* 154 * If the domain we were searching for matches the network's domain, 155 * it's no use redirecting back to ourselves -- it'll cause a loop. 156 * As we couldn't find a site, we're simply not installed. 157 */ 158 ms_not_installed(); 159 } 160 161 header( 'Location: ' . $destination ); 162 exit; 114 163 } 115 164 … … 122 171 // Figure out the current network's main site. 123 172 if ( ! isset( $current_site->blog_id ) ) { 124 if ( $current_blog && $current_blog->domain === $current_site->domain && $current_blog->path === $current_site->path ) {173 if ( $current_blog->domain === $current_site->domain && $current_blog->path === $current_site->path ) { 125 174 $current_site->blog_id = $current_blog->blog_id; 126 175 } else { … … 128 177 $current_site->blog_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s", 129 178 $current_site->domain, $current_site->path ) ); 130 }131 }132 133 // If we haven't figured out our site, give up.134 if ( empty( $current_blog ) ) {135 if ( defined( 'WP_INSTALLING' ) ) {136 $current_blog->blog_id = $blog_id = 1;137 138 } elseif ( is_subdomain_install() ) {139 // @todo This is only for an open registration subdomain network.140 if ( defined( 'NOBLOGREDIRECT' ) ) {141 if ( '%siteurl%' === NOBLOGREDIRECT ) {142 $destination = "http://" . $current_site->domain . $current_site->path;143 } else {144 $destination = NOBLOGREDIRECT;145 }146 } else {147 $destination = 'http://' . $current_site->domain . $current_site->path . 'wp-signup.php?new=' . str_replace( '.' . $current_site->domain, '', $domain );148 }149 header( 'Location: ' . $destination );150 exit;151 152 } else {153 if ( 0 !== strcasecmp( $current_site->domain, $domain ) ) {154 header( 'Location: http://' . $current_site->domain . $current_site->path );155 exit;156 }157 ms_not_installed();158 179 } 159 180 }
Note: See TracChangeset
for help on using the changeset viewer.