Changeset 12921
- Timestamp:
- 02/01/2010 08:26:08 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/default-constants.php
r12771 r12921 1 1 <?php 2 3 2 /** 4 3 * Defines constants and global variables that can be overridden, generally in wp-config.php. … … 95 94 * 96 95 * @since 2.1.0 96 * @deprecated 97 97 */ 98 98 if ( !defined('PLUGINDIR') ) 99 99 define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat. 100 break;101 102 case 'ms_network_settings_loaded':103 100 104 101 /** … … 122 119 * 123 120 * @since 2.8.0 121 * @deprecated 124 122 */ 125 123 if ( !defined( 'MUPLUGINDIR' ) ) … … 150 148 151 149 /** 152 * It is possible to define this in wp-config.php153 150 * @since 2.0.0 154 151 */ … … 157 154 158 155 /** 159 * It is possible to define this in wp-config.php160 156 * @since 2.0.0 161 157 */ … … 164 160 165 161 /** 166 * It is possible to define this in wp-config.php167 162 * @since 2.5.0 168 163 */ … … 171 166 172 167 /** 173 * It is possible to define this in wp-config.php174 168 * @since 2.6.0 175 169 */ … … 178 172 179 173 /** 180 * It is possible to define this in wp-config.php181 174 * @since 2.6.0 182 175 */ … … 185 178 186 179 /** 187 * It is possible to define this in wp-config.php188 180 * @since 2.3.0 189 181 */ … … 192 184 193 185 /** 194 * It is possible to define this in wp-config.php195 186 * @since 1.2.0 196 187 */ … … 199 190 200 191 /** 201 * It is possible to define this in wp-config.php202 192 * @since 1.5.0 203 193 */ … … 206 196 207 197 /** 208 * It is possible to define this in wp-config.php209 198 * @since 2.6.0 210 199 */ … … 213 202 214 203 /** 215 * It is possible to define this in wp-config.php216 204 * @since 2.6.0 217 205 */ … … 220 208 221 209 /** 222 * It is possible to define this in wp-config.php223 210 * @since 2.0.0 224 211 */ … … 227 214 228 215 /** 229 * It is possible to define this in wp-config.php230 216 * @since 2.6.0 231 217 */ … … 235 221 236 222 /** 237 * It is possible to define this in wp-config.php238 223 * @since 2.6.0 239 224 */ … … 243 228 244 229 /** 245 * It is possible to define this in wp-config.php246 230 * @since 2.5.0 247 231 */ … … 250 234 251 235 /** 252 * It is possible to define this in wp-config.php253 236 * @since 2.9.0 254 237 */ -
trunk/wp-includes/ms-default-constants.php
r12886 r12921 17 17 case 'uploads' : 18 18 global $wpdb; 19 /** @since 3.0.0 */ 19 20 if ( !defined( 'UPLOADBLOGSDIR' ) ) 20 21 define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' ); 21 22 /** @since 3.0.0 */ 22 23 if ( !defined( 'UPLOADS' ) ) 23 24 define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" ); 24 25 /** @since 3.0.0 */ 25 26 if ( !defined( 'BLOGUPLOADDIR' ) ) 26 27 define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" ); … … 29 30 global $current_site; 30 31 /** 31 * It is possible to define this in wp-config.php32 32 * @since 1.2.0 33 33 */ 34 34 if ( !defined( 'COOKIEPATH' ) ) 35 35 define( 'COOKIEPATH', $current_site->path ); 36 37 36 /** 38 * It is possible to define this in wp-config.php39 37 * @since 1.5.0 40 38 */ 41 39 if ( !defined( 'SITECOOKIEPATH' ) ) 42 40 define( 'SITECOOKIEPATH', $current_site->path ); 43 44 41 /** 45 * It is possible to define this in wp-config.php46 42 * @since 2.6.0 47 43 */ … … 54 50 } 55 51 /** 56 * It is possible to define this in wp-config.php57 52 * @since 2.0.0 58 53 */ -
trunk/wp-includes/ms-load.php
r12901 r12921 10 10 11 11 /** 12 * Whether a subdomain configuration is enabled 12 * Whether a subdomain configuration is enabled. 13 13 * 14 14 * @since 3.0 … … 23 23 } 24 24 25 function ms_network_settings() { 26 global $wpdb, $current_site, $cookiehash; 27 28 if ( !isset($current_site->site_name) ) 29 $current_site->site_name = get_site_option('site_name'); 30 31 if ( $current_site->site_name == false ) 32 $current_site->site_name = ucfirst( $current_site->domain ); 33 } 34 25 /** 26 * Returns array of sitewide plugin files to be included in global scope. 27 * 28 * @access private 29 * @since 3.0.0 30 * @return array Files to include 31 */ 35 32 function ms_network_plugins() { 36 33 $network_plugins = array(); … … 63 60 } 64 61 62 /** 63 * Checks status of current blog. 64 * 65 * Checks if the blog is deleted, inactive, archived, or spammed. 66 * 67 * Dies with a default message if the blog does not pass the check. 68 * 69 * To change the default message when a blog does not pass the check, 70 * use the wp-content/blog-deleted.php, blog-inactive.php and 71 * blog-suspended.php drop-ins. 72 * 73 * @return bool|string Returns true on success, or drop-in file to include. 74 */ 65 75 function ms_site_check() { 66 76 global $wpdb, $current_blog; 67 77 68 78 if ( '1' == $current_blog->deleted ) { 69 if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) ) { 70 return WP_CONTENT_DIR . '/blog-deleted.php'; 71 } else { 72 header('HTTP/1.1 410 Gone'); 73 wp_die(__('This user has elected to delete their account and the content is no longer available.')); 74 } 75 } elseif ( '2' == $current_blog->deleted ) { 76 if ( file_exists( WP_CONTENT_DIR . '/blog-inactive.php' ) ) 77 return WP_CONTENT_DIR . '/blog-inactive.php'; 78 else 79 wp_die( sprintf( __( 'This blog has not been activated yet. If you are having problems activating your blog, please contact <a href="mailto:%1$s">%1$s</a>.' ), str_replace( '@', ' AT ', get_site_option( 'admin_email', "support@{$current_site->domain}" ) ) ) ); 79 if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) ) { 80 return WP_CONTENT_DIR . '/blog-deleted.php'; 81 } else { 82 header( 'HTTP/1.1 410 Gone' ); 83 wp_die( __( 'This user has elected to delete their account and the content is no longer available.' ) ); 84 } 85 } 86 87 if ( '2' == $current_blog->deleted ) { 88 if ( file_exists( WP_CONTENT_DIR . '/blog-inactive.php' ) ) 89 return WP_CONTENT_DIR . '/blog-inactive.php'; 90 else 91 wp_die( sprintf( __( 'This blog has not been activated yet. If you are having problems activating your blog, please contact <a href="mailto:%1$s">%1$s</a>.' ), str_replace( '@', ' AT ', get_site_option( 'admin_email', "support@{$current_site->domain}" ) ) ) ); 80 92 } 81 93 82 94 if ( $current_blog->archived == '1' || $current_blog->spam == '1' ) { 83 84 85 86 header('HTTP/1.1 410 Gone');87 wp_die(__('This blog has been archived or suspended.'));88 95 if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) ) { 96 return WP_CONTENT_DIR . '/blog-suspended.php'; 97 } else { 98 header( 'HTTP/1.1 410 Gone' ); 99 wp_die( __( 'This blog has been archived or suspended.' ) ); 100 } 89 101 } 90 102 … … 92 104 } 93 105 106 /** 107 * Sets current site name. 108 * 109 * @access private 110 * @since 3.0.0 111 * @return object $current_site object with site_name 112 */ 94 113 function get_current_site_name( $current_site ) { 95 114 global $wpdb; 96 115 $current_site->site_name = wp_cache_get( $current_site->id . ':current_site_name', "site-options" ); 97 if ( ! $current_site->site_name ) {116 if ( ! $current_site->site_name ) { 98 117 $current_site->site_name = $wpdb->get_var( $wpdb->prepare( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = %d AND meta_key = 'site_name'", $current_site->id ) ); 99 if ( $current_site->site_name == null)118 if ( ! $current_site->site_name ) 100 119 $current_site->site_name = ucfirst( $current_site->domain ); 101 wp_cache_set( $current_site->id . ':current_site_name', $current_site->site_name, 'site-options' );120 wp_cache_set( $current_site->id . ':current_site_name', $current_site->site_name, 'site-options' ); 102 121 } 103 122 return $current_site; 104 123 } 105 124 125 /** 126 * Sets current_site object. 127 * 128 * @access private 129 * @since 3.0.0 130 * @return object $current_site object 131 */ 106 132 function wpmu_current_site() { 107 133 global $wpdb, $current_site, $domain, $path, $sites, $cookie_domain; … … 122 148 } 123 149 124 $current_site = wp_cache_get( "current_site", "site-options");150 $current_site = wp_cache_get( 'current_site', 'site-options' ); 125 151 if ( $current_site ) 126 152 return $current_site; 127 153 128 154 $sites = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); // usually only one site 129 if ( count( $sites ) == 1) {155 if ( 1 == count( $sites ) ) { 130 156 $current_site = $sites[0]; 131 157 $path = $current_site->path; 132 $current_site->blog_id = $wpdb->get_var( "SELECT blog_id FROM {$wpdb->blogs} WHERE domain='{$current_site->domain}' AND path='{$current_site->path}'");158 $current_site->blog_id = $wpdb->get_var( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE domain = %s AND path = %s", $current_site->domain, $current_site->path ) ); 133 159 $current_site = get_current_site_name( $current_site ); 134 160 if ( substr( $current_site->domain, 0, 4 ) == 'www.' ) 135 161 $current_site->cookie_domain = substr( $current_site->domain, 4 ); 136 wp_cache_set( "current_site", $current_site, "site-options");162 wp_cache_set( 'current_site', $current_site, 'site-options' ); 137 163 return $current_site; 138 164 } … … 140 166 141 167 if ( $domain == $cookie_domain ) 142 $current_site = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $domain, $path ) );168 $current_site = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $domain, $path ) ); 143 169 else 144 $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain IN ( %s, %s ) AND path = %s ORDER BY CHAR_LENGTH( domain ) DESC LIMIT 1", $domain, $cookie_domain, $path ) ); 145 if ( $current_site == null ) { 170 $current_site = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->site WHERE domain IN ( %s, %s ) AND path = %s ORDER BY CHAR_LENGTH( domain ) DESC LIMIT 1", $domain, $cookie_domain, $path ) ); 171 172 if ( ! $current_site ) { 146 173 if ( $domain == $cookie_domain ) 147 174 $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $domain ) ); … … 149 176 $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain IN ( %s, %s ) AND path = '/' ORDER BY CHAR_LENGTH( domain ) DESC LIMIT 1", $domain, $cookie_domain, $path ) ); 150 177 } 151 if ( $current_site != null ) { 178 179 if ( $current_site ) { 152 180 $path = $current_site->path; 153 181 $current_site->cookie_domain = $cookie_domain; 154 182 return $current_site; 155 } elseif ( is_subdomain_install() ) { 183 } 184 185 if ( is_subdomain_install() ) { 156 186 $sitedomain = substr( $domain, 1 + strpos( $domain, '.' ) ); 157 187 $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path = %s", $sitedomain, $path) ); 158 if ( $current_site != null) {188 if ( $current_site ) { 159 189 $current_site->cookie_domain = $current_site->domain; 160 190 return $current_site; 161 191 } 192 162 193 $current_site = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->site WHERE domain = %s AND path='/'", $sitedomain) ); 163 if ( $current_site == null && defined( "WP_INSTALLING" ) == false ) { 164 if ( count( $sites ) == 1 ) { 165 $current_site = $sites[0]; 166 die( "That blog does not exist. Please try <a href='http://{$current_site->domain}{$current_site->path}'>http://{$current_site->domain}{$current_site->path}</a>" ); 167 } else { 168 die( "No WPMU site defined on this host. If you are the owner of this site, please check <a href='http://codex.wordpress.org/Debugging_WPMU'>Debugging WPMU</a> for further assistance." ); 169 } 170 } else { 171 $path = '/'; 172 } 173 } elseif ( defined( "WP_INSTALLING" ) == false ) { 174 if ( count( $sites ) == 1 ) { 175 $current_site = $sites[0]; 176 die( "That blog does not exist. Please try <a href='http://{$current_site->domain}{$current_site->path}'>http://{$current_site->domain}{$current_site->path}</a>" ); 177 } else { 178 die( "No WPMU site defined on this host. If you are the owner of this site, please check <a href='http://codex.wordpress.org/Debugging_WPMU'>Debugging WPMU</a> for further assistance." ); 179 } 180 } else { 194 } 195 196 if ( $current_site || defined( 'WP_INSTALLING' ) ) { 181 197 $path = '/'; 182 } 183 return $current_site; 184 } 185 198 return $current_site; 199 } 200 201 // Still no dice. 202 // @todo Update or remove WPMU codex link. 203 if ( 1 == count( $sites ) ) 204 wp_die( sprintf( __( 'That blog does not exist. Please try <a href="%s">%s</a>.' ), $sites[0]->domain . $sites[0]->path ) ); 205 else 206 wp_die( __( 'No site defined on this host. If you are the owner of this site, please check <a href="http://codex.wordpress.org/Debugging_WPMU">Debugging WPMU</a> for further assistance.' ) ); 207 } 208 209 /** 210 * Displays a failure message when blog does not exist. 211 * 212 * Checks for a missing $wpdb->site table as well. 213 * 214 * @todo Merge with is_blog_installed(), dead_db(), wp_not_installed(), etc. 215 * @access private 216 * @since 3.0.0 217 */ 186 218 function is_installed() { 187 219 global $wpdb, $domain, $path; 188 220 $base = stripslashes( $base ); 189 if ( defined( "WP_INSTALLING" ) == false ) { 190 $check = $wpdb->get_results( "SELECT * FROM $wpdb->site" ); 191 $msg = "If your blog does not display, please contact the owner of this site.<br /><br />If you are the owner of this site please check that MySQL is running properly and all tables are error free.<br /><br />"; 192 if ( $check == false ) { 193 $msg .= "<strong>Database Tables Missing.</strong><br />Database tables are missing. This means that MySQL is either not running, WPMU was not installed properly, or someone deleted {$wpdb->site}. You really <em>should</em> look at your database now.<br />"; 194 } else { 195 $msg .= '<strong>Could Not Find Blog!</strong><br />'; 196 $msg .= "Searched for <em>" . $domain . $path . "</em> in " . DB_NAME . "::" . $wpdb->blogs . " table. Is that right?<br />"; 197 } 198 $msg .= "<br />\n<h1>What do I do now?</h1>"; 199 $msg .= "Read the <a target='_blank' href='http://codex.wordpress.org/Debugging_WPMU'>bug report</a> page. Some of the guidelines there may help you figure out what went wrong.<br />"; 200 $msg .= "If you're still stuck with this message, then check that your database contains the following tables:<ul> 201 <li> $wpdb->blogs </li> 202 <li> $wpdb->users </li> 203 <li> $wpdb->usermeta </li> 204 <li> $wpdb->site </li> 205 <li> $wpdb->sitemeta </li> 206 <li> $wpdb->sitecategories </li> 207 </ul>"; 208 $msg .= "If you suspect a problem please report it to the support forums but you must include the information asked for in the <a href='http://codex.wordpress.org/Debugging_WPMU'>WPMU bug reporting guidelines</a>!<br /><br />"; 209 if ( is_file( 'release-info.txt' ) ) { 210 $msg .= 'Your bug report must include the following text: "'; 211 $info = file( 'release-info.txt' ); 212 $msg .= $info[ 4 ] . '"'; 213 } 214 215 die( "<h1>Fatal Error</h1> " . $msg ); 216 } 221 if ( defined( 'WP_INSTALLING' ) ) 222 return; 223 224 $msg = '<h1>' . esc_html__( 'Fatal Error' ) . '</h1>'; 225 $msg = '<p>' . __( 'If your blog does not display, please contact the owner of this site.' ) . '</p>'; 226 $msg .= '<p>' . __( 'If you are the owner of this site please check that MySQL is running properly and all tables are error free.' ) . '</p>'; 227 if ( ! $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->site'" ) ) 228 $msg .= '<p>' . sprintf( __( '<strong>Database tables are missing.</strong> This means that MySQL is not running, WordPress was not installed properly, or someone deleted <code>%s</code>. You really <em>should</em> look at your database now.' ), $wpdb->site ) . '</p>'; 229 else 230 $msg .= '<p>' . sprintf( __( '<strong>Could Not Find Blog!</strong> Searched for table <em>%1$s</em> in <code>%2$s</code>. Is that right?' ), $domain . $path, DB_NAME, $wpdb->blogs ) . '</p>'; 231 $msg .= '<h1>' . esc_html__( 'What do I do now?' ) . '</h1>'; 232 // @todo Update WPMU codex link. 233 $msg .= '<p>' . __( 'Read the <a target="_blank" href="http://codex.wordpress.org/Debugging_WPMU">bug report</a> page. Some of the guidelines there may help you figure out what went wrong.' ) . '</p>'; 234 $msg .= '<p>' . __( "If you're still stuck with this message, then check that your database contains the following tables:" ) . '</p><ul>'; 235 foreach ( $wpdb->global_tables as $table ) { 236 $msg .= '<li>' . $wpdb->prefix . $table . '</li>'; 237 } 238 $msg .= '</ul>'; 239 // @todo Update WPMU codex link and support instructions. 240 $msg = '<p>' . __( 'If you suspect a problem please report it to the support forums but you must include the information asked for in the <a target="_blank" href="http://codex.wordpress.org/Debugging_WPMU">WPMU bug reporting guidelines</a>! ' ) . '</p>'; 241 242 // @todo This file no longer exists post-merge. 243 if ( is_file( 'release-info.txt' ) ) { 244 $msg .= '<p>' . __( 'Your bug report must include the following text:' ) . '</p>'; 245 $info = file( 'release-info.txt' ); 246 $msg .= $info[ 4 ] . '"'; 247 } 248 249 die( $msg ); 217 250 } 218 251 -
trunk/wp-includes/ms-settings.php
r12901 r12921 65 65 $reserved_blognames = array( 'page', 'comments', 'blog', 'wp-admin', 'wp-includes', 'wp-content', 'files', 'feed' ); 66 66 if ( $blogname != '' && ! in_array( $blogname, $reserved_blognames ) && ! is_file( $blogname ) ) 67 $path = $path .$blogname . '/';67 $path .= $blogname . '/'; 68 68 $current_blog = wp_cache_get( 'current_blog_' . $domain . $path, 'site-options' ); 69 69 if ( ! $current_blog ) { … … 82 82 $destination = 'http://' . $current_site->domain . $current_site->path . 'wp-signup.php?new=' . str_replace( '.' . $current_site->domain, '', $domain ); 83 83 } 84 wp_redirect($destination );84 header( 'Location: ' . $destination ); 85 85 die(); 86 86 } … … 89 89 if ( $current_site && ! $current_blog ) { 90 90 if ( $current_site->domain != $_SERVER[ 'HTTP_HOST' ] ) { 91 wp_redirect( 'http://' . $current_site->domain . $current_site->path );91 header( 'Location: http://' . $current_site->domain . $current_site->path ); 92 92 exit; 93 93 } -
trunk/wp-settings.php
r12885 r12921 133 133 134 134 // Define constants that rely on the API to obtain the default value. 135 // Define must-use plugin directory constants, which may be overridden in the sunrise.php drop-in. 135 136 wp_default_constants( 'wp_included' ); 136 137 // Set up multisite if enabled.138 if ( is_multisite() )139 ms_network_settings();140 141 // Define must-use plugin directory constants, which may be overridden in the sunrise.php drop-in.142 wp_default_constants( 'ms_network_settings_loaded' );143 137 144 138 // Load must-use plugins.
Note: See TracChangeset
for help on using the changeset viewer.