Ticket #11644: 11644.9.diff
File 11644.9.diff, 14.6 KB (added by , 15 years ago) |
---|
-
wp-includes/default-constants.php
1 1 <?php 2 3 2 /** 4 3 * Defines constants and global variables that can be overridden, generally in wp-config.php. 5 4 * … … 94 93 * Allows for the plugins directory to be moved from the default location. 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 100 102 case 'ms_network_settings_loaded':103 104 101 /** 105 102 * Allows for the mu-plugins directory to be moved from the default location. 106 103 * … … 121 118 * Allows for the mu-plugins directory to be moved from the default location. 122 119 * 123 120 * @since 2.8.0 121 * @deprecated 124 122 */ 125 123 if ( !defined( 'MUPLUGINDIR' ) ) 126 124 define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat. … … 149 147 $wp_default_secret_key = 'put your unique phrase here'; 150 148 151 149 /** 152 * It is possible to define this in wp-config.php153 150 * @since 2.0.0 154 151 */ 155 152 if ( !defined('USER_COOKIE') ) 156 153 define('USER_COOKIE', 'wordpressuser_' . COOKIEHASH); 157 154 158 155 /** 159 * It is possible to define this in wp-config.php160 156 * @since 2.0.0 161 157 */ 162 158 if ( !defined('PASS_COOKIE') ) 163 159 define('PASS_COOKIE', 'wordpresspass_' . COOKIEHASH); 164 160 165 161 /** 166 * It is possible to define this in wp-config.php167 162 * @since 2.5.0 168 163 */ 169 164 if ( !defined('AUTH_COOKIE') ) 170 165 define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH); 171 166 172 167 /** 173 * It is possible to define this in wp-config.php174 168 * @since 2.6.0 175 169 */ 176 170 if ( !defined('SECURE_AUTH_COOKIE') ) 177 171 define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH); 178 172 179 173 /** 180 * It is possible to define this in wp-config.php181 174 * @since 2.6.0 182 175 */ 183 176 if ( !defined('LOGGED_IN_COOKIE') ) 184 177 define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH); 185 178 186 179 /** 187 * It is possible to define this in wp-config.php188 180 * @since 2.3.0 189 181 */ 190 182 if ( !defined('TEST_COOKIE') ) 191 183 define('TEST_COOKIE', 'wordpress_test_cookie'); 192 184 193 185 /** 194 * It is possible to define this in wp-config.php195 186 * @since 1.2.0 196 187 */ 197 188 if ( !defined('COOKIEPATH') ) 198 189 define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) ); 199 190 200 191 /** 201 * It is possible to define this in wp-config.php202 192 * @since 1.5.0 203 193 */ 204 194 if ( !defined('SITECOOKIEPATH') ) 205 195 define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) ); 206 196 207 197 /** 208 * It is possible to define this in wp-config.php209 198 * @since 2.6.0 210 199 */ 211 200 if ( !defined('ADMIN_COOKIE_PATH') ) 212 201 define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' ); 213 202 214 203 /** 215 * It is possible to define this in wp-config.php216 204 * @since 2.6.0 217 205 */ 218 206 if ( !defined('PLUGINS_COOKIE_PATH') ) 219 207 define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL) ); 220 208 221 209 /** 222 * It is possible to define this in wp-config.php223 210 * @since 2.0.0 224 211 */ 225 212 if ( !defined('COOKIE_DOMAIN') ) 226 213 define('COOKIE_DOMAIN', false); 227 214 228 215 /** 229 * It is possible to define this in wp-config.php230 216 * @since 2.6.0 231 217 */ 232 218 if ( !defined('FORCE_SSL_ADMIN') ) … … 234 220 force_ssl_admin(FORCE_SSL_ADMIN); 235 221 236 222 /** 237 * It is possible to define this in wp-config.php238 223 * @since 2.6.0 239 224 */ 240 225 if ( !defined('FORCE_SSL_LOGIN') ) … … 242 227 force_ssl_login(FORCE_SSL_LOGIN); 243 228 244 229 /** 245 * It is possible to define this in wp-config.php246 230 * @since 2.5.0 247 231 */ 248 232 if ( !defined( 'AUTOSAVE_INTERVAL' ) ) 249 233 define( 'AUTOSAVE_INTERVAL', 60 ); 250 234 251 235 /** 252 * It is possible to define this in wp-config.php253 236 * @since 2.9.0 254 237 */ 255 238 if ( !defined( 'EMPTY_TRASH_DAYS' ) ) -
wp-includes/ms-default-constants.php
16 16 switch( $context ) { 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/" ); 27 28 break; 28 29 case 'cookies' : 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 */ 48 44 if ( !defined( 'ADMIN_COOKIE_PATH' ) ) { … … 53 49 } 54 50 } 55 51 /** 56 * It is possible to define this in wp-config.php57 52 * @since 2.0.0 58 53 */ 59 54 if ( !defined('COOKIE_DOMAIN') ) -
wp-includes/ms-load.php
9 9 */ 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 15 15 * … … 22 22 return false; 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(); 37 34 $deleted_sitewide_plugins = array(); … … 62 59 return $network_plugins; 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 … … 69 79 if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) ) { 70 80 return WP_CONTENT_DIR . '/blog-deleted.php'; 71 81 } 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.'));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.' ) ); 74 84 } 75 } elseif ( '2' == $current_blog->deleted ) { 85 } 86 87 if ( '2' == $current_blog->deleted ) { 76 88 if ( file_exists( WP_CONTENT_DIR . '/blog-inactive.php' ) ) 77 89 return WP_CONTENT_DIR . '/blog-inactive.php'; 78 90 else … … 83 95 if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) ) { 84 96 return WP_CONTENT_DIR . '/blog-suspended.php'; 85 97 } else { 86 header( 'HTTP/1.1 410 Gone');87 wp_die( __('This blog has been archived or suspended.'));98 header( 'HTTP/1.1 410 Gone' ); 99 wp_die( __( 'This blog has been archived or suspended.' ) ); 88 100 } 89 101 } 90 102 91 103 return true; 92 104 } 93 105 106 /** 107 * Gets current site name. 108 * 109 * @since 3.0.0 110 * @return string Name of site 111 */ 94 112 function get_current_site_name( $current_site ) { 95 113 global $wpdb; 96 114 $current_site->site_name = wp_cache_get( $current_site->id . ':current_site_name', "site-options" ); 97 if ( ! $current_site->site_name ) {115 if ( ! $current_site->site_name ) { 98 116 $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)117 if ( ! $current_site->site_name ) 100 118 $current_site->site_name = ucfirst( $current_site->domain ); 101 wp_cache_set( $current_site->id . ':current_site_name', $current_site->site_name, 'site-options' );119 wp_cache_set( $current_site->id . ':current_site_name', $current_site->site_name, 'site-options' ); 102 120 } 103 121 return $current_site; 104 122 } … … 186 204 function is_installed() { 187 205 global $wpdb, $domain, $path; 188 206 $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 } 207 if ( defined( 'WP_INSTALLING' ) ) 208 return; 214 209 215 die( "<h1>Fatal Error</h1> " . $msg ); 210 $msg = '<h1>' . esc_html__( 'Fatal Error' ) . '</h1>'; 211 $msg = '<p>' . __( 'If your blog does not display, please contact the owner of this site.' ) . '</p>'; 212 $msg .= '<p>' . __( 'If you are the owner of this site please check that MySQL is running properly and all tables are error free.' ) . '</p>'; 213 if ( ! $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->site'" ) ) 214 $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>'; 215 else 216 $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>'; 217 $msg .= '<h1>' . esc_html__( 'What do I do now?' ) . '</h1>'; 218 // @todo Update WPMU codex link. 219 $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>'; 220 $msg .= '<p>' . __( "If you're still stuck with this message, then check that your database contains the following tables:" ) . '</p><ul>'; 221 foreach ( $wpdb->global_tables as $table ) { 222 $msg .= '<li>' . $wpdb->prefix . $table . '</li>'; 216 223 } 224 $msg .= '</ul>'; 225 // @todo Update WPMU codex link and support instructions. 226 $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>'; 227 228 // @todo This file no longer exists post-merge. 229 if ( is_file( 'release-info.txt' ) ) { 230 $msg .= '<p>' . __( 'Your bug report must include the following text:' ) . '</p>'; 231 $info = file( 'release-info.txt' ); 232 $msg .= $info[ 4 ] . '"'; 233 } 234 235 die( $msg ); 217 236 } 218 237 219 238 ?> -
wp-includes/ms-settings.php
64 64 $blogname = substr( $blogname, 0, strpos( $blogname, '?' ) ); 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 ) { 70 70 $current_blog = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->blogs WHERE domain = %s AND path = %s", $domain, $path ) ); … … 104 104 $current_blog->site_id = 1; 105 105 $site_id = $current_blog->site_id; 106 106 107 $current_site = get_current_site_name( $current_site );108 109 107 if ( ! $blog_id ) { 110 108 if ( defined('WP_INSTALLING') ) { 111 109 $current_blog->blog_id = $blog_id = 1; … … 120 118 $wpdb->set_prefix( $table_prefix ); // set up blog tables 121 119 $table_prefix = $wpdb->get_blog_prefix(); 122 120 121 $current_site = get_current_site_name( $current_site ); 122 123 123 // need to init cache again after blog_id is set 124 124 wp_start_object_cache(); 125 125 -
wp-settings.php
132 132 } 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 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 144 138 // Load must-use plugins. 145 139 foreach( wp_muplugins_to_load() as $mu_plugin ) 146 140 include_once( $mu_plugin );