Ticket #19235: 19235.3.diff
File 19235.3.diff, 27.2 KB (added by , 12 years ago) |
---|
-
wp-includes/ms-default-filters.php
61 61 // WP_HOME and WP_SITEURL should not have any effect in MS 62 62 remove_filter( 'option_siteurl', '_config_wp_siteurl' ); 63 63 remove_filter( 'option_home', '_config_wp_home' ); 64 65 // If the network upgrade hasn't run yet, assume ms-files.php rewriting is used. 66 add_filter( 'default_site_option_ms_files_rewriting', '__return_true' ); 67 No newline at end of file -
wp-includes/post.php
204 204 return false; 205 205 206 206 $file = apply_filters( 'update_attached_file', $file, $attachment_id ); 207 $file = _wp_relative_upload_path( $file);207 $file = _wp_relative_upload_path( $file ); 208 208 209 209 return update_post_meta( $attachment_id, '_wp_attached_file', $file ); 210 210 } … … 223 223 function _wp_relative_upload_path( $path ) { 224 224 $new_path = $path; 225 225 226 if ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) { 227 if ( 0 === strpos($new_path, $uploads['basedir']) ) { 228 $new_path = str_replace($uploads['basedir'], '', $new_path); 229 $new_path = ltrim($new_path, '/'); 230 } 226 $uploads = wp_upload_dir(); 227 if ( 0 === strpos( $new_path, $uploads['basedir'] ) ) { 228 $new_path = str_replace( $uploads['basedir'], '', $new_path ); 229 $new_path = ltrim( $new_path, '/' ); 231 230 } 232 231 233 232 return apply_filters( '_wp_relative_upload_path', $new_path, $path ); -
wp-includes/functions.php
1432 1432 * @return array See above for description. 1433 1433 */ 1434 1434 function wp_upload_dir( $time = null ) { 1435 global $switched;1436 1435 $siteurl = get_option( 'siteurl' ); 1437 $upload_path = get_option( 'upload_path' ); 1438 $upload_path = trim($upload_path); 1439 $main_override = is_multisite() && defined( 'MULTISITE' ) && is_main_site(); 1440 if ( empty($upload_path) ) { 1436 $upload_path = trim( get_option( 'upload_path' ) ); 1437 1438 if ( empty( $upload_path ) || 'wp-content/uploads' == $upload_path ) { 1441 1439 $dir = WP_CONTENT_DIR . '/uploads'; 1440 } elseif ( 0 !== strpos( $upload_path, ABSPATH ) ) { 1441 // $dir is absolute, $upload_path is (maybe) relative to ABSPATH 1442 $dir = path_join( ABSPATH, $upload_path ); 1442 1443 } else { 1443 1444 $dir = $upload_path; 1444 if ( 'wp-content/uploads' == $upload_path ) {1445 $dir = WP_CONTENT_DIR . '/uploads';1446 } elseif ( 0 !== strpos($dir, ABSPATH) ) {1447 // $dir is absolute, $upload_path is (maybe) relative to ABSPATH1448 $dir = path_join( ABSPATH, $dir );1449 }1450 1445 } 1451 1446 1452 1447 if ( !$url = get_option( 'upload_url_path' ) ) { … … 1456 1451 $url = trailingslashit( $siteurl ) . $upload_path; 1457 1452 } 1458 1453 1459 if ( defined( 'UPLOADS') && !$main_override && ( !isset( $switched ) || $switched === false) ) {1454 if ( defined( 'UPLOADS' ) ) { 1460 1455 $dir = ABSPATH . UPLOADS; 1461 1456 $url = trailingslashit( $siteurl ) . UPLOADS; 1462 1457 } 1463 1458 1464 if ( is_multisite() && !$main_override && ( !isset( $switched ) || $switched === false ) ) { 1465 if ( defined( 'BLOGUPLOADDIR' ) ) 1466 $dir = untrailingslashit(BLOGUPLOADDIR); 1467 $url = str_replace( UPLOADS, 'files', $url ); 1459 // Multisite (if not the main site in a post-MU network) 1460 if ( is_multisite() && ! ( is_main_site() && defined( 'MULTISITE' ) ) ) { 1461 if ( ! get_site_option( 'ms_files_rewriting' ) ) { 1462 // Append sites/%d if we're not on the main site (for post-MU networks). 1463 $ms_dir = '/sites/' . get_current_blog_id(); 1464 $dir .= $ms_dir; 1465 $url .= $ms_dir; 1466 } elseif ( empty( $GLOBALS['switched'] ) ) { 1467 // Handle the old-form ms-files.php rewriting if the network still has that enabled. 1468 if ( defined( 'BLOGUPLOADDIR' ) ) 1469 $dir = untrailingslashit( BLOGUPLOADDIR ); 1470 $url = str_replace( UPLOADS, 'files', $url ); 1471 } 1468 1472 } 1469 1473 1470 $b dir = $dir;1471 $b url = $url;1474 $basedir = $dir; 1475 $baseurl = $url; 1472 1476 1473 1477 $subdir = ''; 1474 1478 if ( get_option( 'uploads_use_yearmonth_folders' ) ) { … … 1483 1487 $dir .= $subdir; 1484 1488 $url .= $subdir; 1485 1489 1486 $uploads = apply_filters( 'upload_dir', array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $bdir, 'baseurl' => $burl, 'error' => false ) ); 1490 $uploads = apply_filters( 'upload_dir', 1491 array( 1492 'path' => $dir, 1493 'url' => $url, 1494 'subdir' => $subdir, 1495 'basedir' => $basedir, 1496 'baseurl' => $baseurl, 1497 'error' => false, 1498 ) 1499 ); 1487 1500 1488 1501 // Make sure we have an uploads dir 1489 1502 if ( ! wp_mkdir_p( $uploads['path'] ) ) { 1490 1503 $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $uploads['path'] ); 1491 return array( 'error' => $message ); 1504 $uploads['error'] = $message; 1505 return $uploads; 1492 1506 } 1493 1507 1494 1508 return $uploads; -
wp-includes/option.php
174 174 if ( empty($site_id) ) 175 175 $site_id = $wpdb->siteid; 176 176 177 $core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled' );177 $core_options = array('site_name', 'siteurl', 'active_sitewide_plugins', '_site_transient_timeout_theme_roots', '_site_transient_theme_roots', 'site_admins', 'can_compress_scripts', 'global_terms_enabled', 'ms_files_rewriting' ); 178 178 179 179 $core_options_in = "'" . implode("', '", $core_options) . "'"; 180 180 $options = $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value FROM $wpdb->sitemeta WHERE meta_key IN ($core_options_in) AND site_id = %d", $site_id) ); -
wp-includes/rewrite.php
1739 1739 } else { 1740 1740 if (is_subdomain_install()) { 1741 1741 $rules .= ' 1742 <rule name=" wordpress -Rule 1" stopProcessing="true">1742 <rule name="WordPress Rule 1" stopProcessing="true"> 1743 1743 <match url="^index\.php$" ignoreCase="false" /> 1744 1744 <action type="None" /> 1745 </rule> 1746 <rule name="wordpress - Rule 2" stopProcessing="true"> 1745 </rule>'; 1746 if ( get_site_option( 'ms_files_rewriting' ) ) { 1747 $rules .= ' 1748 <rule name="WordPress Rule for Files" stopProcessing="true"> 1747 1749 <match url="^files/(.+)" ignoreCase="false" /> 1748 1750 <action type="Rewrite" url="wp-includes/ms-files.php?file={R:1}" appendQueryString="false" /> 1749 </rule> 1750 <rule name="wordpress - Rule 3" stopProcessing="true"> 1751 </rule>'; 1752 } 1753 $rules .= ' 1754 <rule name="WordPress Rule 2" stopProcessing="true"> 1751 1755 <match url="^" ignoreCase="false" /> 1752 1756 <conditions logicalGrouping="MatchAny"> 1753 1757 <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> … … 1755 1759 </conditions> 1756 1760 <action type="None" /> 1757 1761 </rule> 1758 <rule name=" wordpress - Rule 4" stopProcessing="true">1762 <rule name="WordPress Rule 3" stopProcessing="true"> 1759 1763 <match url="." ignoreCase="false" /> 1760 1764 <action type="Rewrite" url="index.php" /> 1761 1765 </rule>'; 1762 1766 } else { 1763 1767 $rules .= ' 1764 <rule name=" wordpress -Rule 1" stopProcessing="true">1768 <rule name="WordPress Rule 1" stopProcessing="true"> 1765 1769 <match url="^index\.php$" ignoreCase="false" /> 1766 1770 <action type="None" /> 1767 </rule> 1768 <rule name="wordpress - Rule 2" stopProcessing="true"> 1771 </rule>'; 1772 if ( get_site_option( 'ms_files_rewriting' ) ) { 1773 $rules .= ' 1774 <rule name="WordPress Rule for Files" stopProcessing="true"> 1769 1775 <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" /> 1770 1776 <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" /> 1771 </rule> 1772 <rule name="wordpress - Rule 3" stopProcessing="true"> 1777 </rule>'; 1778 } 1779 $rules .= ' 1780 <rule name="WordPress Rule 2" stopProcessing="true"> 1773 1781 <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" /> 1774 1782 <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" /> 1775 1783 </rule> 1776 <rule name=" wordpress - Rule 4" stopProcessing="true">1784 <rule name="WordPress Rule 3" stopProcessing="true"> 1777 1785 <match url="^" ignoreCase="false" /> 1778 1786 <conditions logicalGrouping="MatchAny"> 1779 1787 <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> … … 1781 1789 </conditions> 1782 1790 <action type="None" /> 1783 1791 </rule> 1784 <rule name=" wordpress - Rule 5" stopProcessing="true">1792 <rule name="WordPress Rule 4" stopProcessing="true"> 1785 1793 <match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" /> 1786 1794 <action type="Rewrite" url="{R:1}" /> 1787 1795 </rule> 1788 <rule name=" wordpress - Rule 6" stopProcessing="true">1796 <rule name="WordPress Rule 5" stopProcessing="true"> 1789 1797 <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" /> 1790 1798 <action type="Rewrite" url="{R:2}" /> 1791 1799 </rule> 1792 <rule name=" wordpress - Rule 7" stopProcessing="true">1800 <rule name="WordPress Rule 6" stopProcessing="true"> 1793 1801 <match url="." ignoreCase="false" /> 1794 1802 <action type="Rewrite" url="index.php" /> 1795 1803 </rule>'; -
wp-includes/ms-default-constants.php
10 10 /** 11 11 * Defines Multisite upload constants. 12 12 * 13 * Exists for backward compatibility with legacy file-serving through 14 * wp-includes/ms-files.php (wp-content/blogs.php in MU). 15 * 13 16 * @since 3.0.0 14 17 */ 15 function ms_upload_constants( 18 function ms_upload_constants() { 16 19 global $wpdb; 17 20 21 if ( ! get_site_option( 'ms_files_rewriting' ) ) 22 return; 23 18 24 /** @since 3.0.0 */ 19 25 // Base uploads dir relative to ABSPATH 20 26 if ( !defined( 'UPLOADBLOGSDIR' ) ) … … 24 30 if ( !defined( 'UPLOADS' ) ) { 25 31 // Uploads dir relative to ABSPATH 26 32 define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" ); 27 if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR )33 if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) ) 28 34 define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" ); 29 35 } 30 36 } … … 74 80 /** 75 81 * Defines Multisite file constants. 76 82 * 83 * Exists for backward compatibility with legacy file-serving through 84 * wp-includes/ms-files.php (wp-content/blogs.php in MU). 85 * 77 86 * @since 3.0.0 78 87 */ 79 function ms_file_constants( 88 function ms_file_constants() { 80 89 /** 81 90 * Optional support for X-Sendfile header 82 91 * @since 3.0.0 -
wp-includes/ms-functions.php
1129 1129 * @param string $blog_title The title of the new site. 1130 1130 */ 1131 1131 function install_blog($blog_id, $blog_title = '') { 1132 global $wpdb, $table_prefix, $wp_roles; 1133 $wpdb->suppress_errors(); 1132 global $wpdb, $wp_roles, $current_site; 1134 1133 1135 1134 // Cast for security 1136 1135 $blog_id = (int) $blog_id; … … 1138 1137 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 1139 1138 1140 1139 if ( $wpdb->get_results("SELECT ID FROM $wpdb->posts") ) 1141 die( __('<h1>Already Installed</h1><p>You appear to have already installed WordPress. To reinstall please clear your old database tables first.</p>') . '</body></html>');1140 die( __( '<h1>Already Installed</h1><p>You appear to have already installed WordPress. To reinstall please clear your old database tables first.</p>' ) . '</body></html>' ); 1142 1141 1143 $ wpdb->suppress_errors(false);1142 $url = get_blogaddress_by_id( $blog_id ); 1144 1143 1145 $url = get_blogaddress_by_id($blog_id);1146 1147 1144 // Set everything up 1148 1145 make_db_current_silent( 'blog' ); 1149 1146 populate_options(); … … 1151 1148 $wp_roles->_init(); 1152 1149 1153 1150 $url = untrailingslashit( $url ); 1154 // fix url.1155 update_option('siteurl', $url);1156 update_option('home', $url);1157 update_option('fileupload_url', $url . "/files" );1158 update_option('upload_path', UPLOADBLOGSDIR . "/$blog_id/files");1159 update_option('blogname', stripslashes( $blog_title ) );1160 update_option('admin_email', '');1161 $wpdb->update( $wpdb->options, array('option_value' => ''), array('option_name' => 'admin_email') );1162 1151 1163 // remove all perms1164 $wpdb->delete( $wpdb->usermeta, array( 'meta_key' => $table_prefix.'user_level' ));1152 update_option( 'siteurl', $url ); 1153 update_option( 'home', $url ); 1165 1154 1166 $wpdb->delete( $wpdb->usermeta, array( 'meta_key' => $table_prefix.'capabilities' ) ); 1155 if ( get_site_option( 'ms_files_rewriting' ) ) 1156 update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" ); 1157 else 1158 update_option( 'upload_path', get_blog_option( $current_site->blog_id, 'upload_path' ) ); 1167 1159 1168 $wpdb->suppress_errors( false ); 1160 update_option( 'blogname', stripslashes( $blog_title ) ); 1161 update_option( 'admin_email', '' ); 1162 1163 // remove all perms 1164 $table_prefix = $wpdb->get_blog_prefix(); 1165 delete_metadata( 'user', 0, $table_prefix . 'user_level', null, true ); // delete all 1166 delete_metadata( 'user', 0, $table_prefix . 'capabilities', null, true ); // delete all 1169 1167 } 1170 1168 1171 1169 /** -
wp-admin/network.php
106 106 $network_help = '<p>' . __('This screen allows you to configure a network as having subdomains (<code>site1.example.com</code>) or subdirectories (<code>example.com/site1</code>). Subdomains require wildcard subdomains to be enabled in Apache and DNS records, if your host allows it.') . '</p>' . 107 107 '<p>' . __('Choose subdomains or subdirectories; this can only be switched afterwards by reconfiguring your install. Fill out the network details, and click install. If this does not work, you may have to add a wildcard DNS record (for subdomains) or change to another setting in Permalinks (for subdirectories).') . '</p>' . 108 108 '<p>' . __('The next screen for Network Setup will give you individually-generated lines of code to add to your wp-config.php and .htaccess files. Make sure the settings of your FTP client make files starting with a dot visible, so that you can find .htaccess; you may have to create this file if it really is not there. Make backup copies of those two files.') . '</p>' . 109 '<p>' . __('Add a <code>blogs.dir</code> directory under <code>/wp-content</code> and addthe designated lines of code to wp-config.php (just before <code>/*...stop editing...*/</code>) and <code>.htaccess</code> (replacing the existing WordPress rules).') . '</p>' .109 '<p>' . __('Add the designated lines of code to wp-config.php (just before <code>/*...stop editing...*/</code>) and <code>.htaccess</code> (replacing the existing WordPress rules).') . '</p>' . 110 110 '<p>' . __('Once you add this code and refresh your browser, multisite should be enabled. This screen, now in the Network Admin navigation menu, will keep an archive of the added code. You can toggle between Network Admin and Site Admin by clicking on the Network Admin or an individual site name under the My Sites dropdown in the Toolbar.') . '</p>' . 111 111 '<p>' . __('The choice of subdirectory sites is disabled if this setup is more than a month old because of permalink problems with “/blog/” from the main site. This disabling will be addressed in a future version.') . '</p>' . 112 112 '<p><strong>' . __('For more information:') . '</strong></p>' . … … 190 190 $error_codes = $errors->get_error_codes(); 191 191 } 192 192 193 if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' )194 echo '<div class="error"><p><strong>' . __('Warning!') . '</strong> ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>';195 196 193 $site_name = ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes ) ) ? $_POST['sitename'] : sprintf( _x('%s Sites', 'Default network name' ), get_option( 'blogname' ) ); 197 194 $admin_email = ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes ) ) ? $_POST['email'] : get_option( 'admin_email' ); 198 195 ?> … … 235 232 <?php 236 233 endif; 237 234 235 if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' && ( allow_subdirectory_install() || ! allow_subdomain_install() ) ) 236 echo '<div class="error inline"><p><strong>' . __('Warning!') . '</strong> ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>'; 237 238 238 $is_www = ( 0 === strpos( $hostname, 'www.' ) ); 239 239 if ( $is_www ) : 240 240 ?> … … 360 360 } 361 361 ?> 362 362 <ol> 363 <li><p><?php364 printf( __( 'Create a <code>blogs.dir</code> directory at <code>%s/blogs.dir</code>. This directory is used to store uploaded media for your additional sites and must be writeable by the web server.' ), WP_CONTENT_DIR );365 if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' )366 echo ' <strong>' . __('Warning:') . ' ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '</strong>';367 ?></p></li>368 363 <li><p><?php printf( __( 'Add the following to your <code>wp-config.php</code> file in <code>%s</code> <strong>above</strong> the line reading <code>/* That’s all, stop editing! Happy blogging. */</code>:' ), ABSPATH ); ?></p> 369 364 <textarea class="code" readonly="readonly" cols="100" rows="7"> 370 365 define('MULTISITE', true); … … 415 410 <rule name="WordPress Rule 1" stopProcessing="true"> 416 411 <match url="^index\.php$" ignoreCase="false" /> 417 412 <action type="None" /> 418 </rule> 419 <rule name="WordPress Rule 2" stopProcessing="true"> 413 </rule>'; 414 if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) { 415 $web_config_file .= ' 416 <rule name="WordPress Rule for Files" stopProcessing="true"> 420 417 <match url="^files/(.+)" ignoreCase="false" /> 421 418 <action type="Rewrite" url="wp-includes/ms-files.php?file={R:1}" appendQueryString="false" /> 422 </rule> 423 <rule name="WordPress Rule 3" stopProcessing="true"> 419 </rule>'; 420 } 421 $web_config_file .= ' 422 <rule name="WordPress Rule 2" stopProcessing="true"> 424 423 <match url="^" ignoreCase="false" /> 425 424 <conditions logicalGrouping="MatchAny"> 426 425 <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> … … 428 427 </conditions> 429 428 <action type="None" /> 430 429 </rule> 431 <rule name="WordPress Rule 4" stopProcessing="true">430 <rule name="WordPress Rule 3" stopProcessing="true"> 432 431 <match url="." ignoreCase="false" /> 433 432 <action type="Rewrite" url="index.php" /> 434 433 </rule> … … 446 445 <rule name="WordPress Rule 1" stopProcessing="true"> 447 446 <match url="^index\.php$" ignoreCase="false" /> 448 447 <action type="None" /> 449 </rule> 448 </rule>'; 449 if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) { 450 $web_config_file .= ' 451 <rule name="WordPress Rule for Files" stopProcessing="true"> 452 <match url="^files/(.+)" ignoreCase="false" /> 453 <action type="Rewrite" url="wp-includes/ms-files.php?file={R:1}" appendQueryString="false" /> 454 </rule>'; 455 } 456 $web_config_file .= ' 450 457 <rule name="WordPress Rule 2" stopProcessing="true"> 451 <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" />452 <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" />453 </rule>454 <rule name="WordPress Rule 3" stopProcessing="true">455 458 <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" /> 456 459 <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" /> 457 460 </rule> 458 <rule name="WordPress Rule 4" stopProcessing="true">461 <rule name="WordPress Rule 3" stopProcessing="true"> 459 462 <match url="^" ignoreCase="false" /> 460 463 <conditions logicalGrouping="MatchAny"> 461 464 <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" /> … … 463 466 </conditions> 464 467 <action type="None" /> 465 468 </rule> 466 <rule name="WordPress Rule 5" stopProcessing="true">469 <rule name="WordPress Rule 4" stopProcessing="true"> 467 470 <match url="^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*)" ignoreCase="false" /> 468 471 <action type="Rewrite" url="{R:1}" /> 469 472 </rule> 470 <rule name="WordPress Rule 6" stopProcessing="true">473 <rule name="WordPress Rule 5" stopProcessing="true"> 471 474 <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" /> 472 475 <action type="Rewrite" url="{R:2}" /> 473 476 </rule> 474 <rule name="WordPress Rule 7" stopProcessing="true">477 <rule name="WordPress Rule 6" stopProcessing="true"> 475 478 <match url="." ignoreCase="false" /> 476 479 <action type="Rewrite" url="index.php" /> 477 480 </rule> … … 482 485 } 483 486 ?> 484 487 <li><p><?php printf( __( 'Add the following to your <code>web.config</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p> 485 <textarea class="code" readonly="readonly" cols="100" rows="20"> 486 <?php echo esc_textarea( $web_config_file ); ?> 488 <?php 489 if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' ) 490 echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>'; 491 ?> 492 <textarea class="code" readonly="readonly" cols="100" rows="20"><?php echo esc_textarea( $web_config_file ); ?> 487 493 </textarea></li> 488 494 </ol> 489 495 … … 491 497 492 498 $htaccess_file = 'RewriteEngine On 493 499 RewriteBase ' . $base . ' 494 RewriteRule ^index\.php$ - [L] 500 RewriteRule ^index\.php$ - [L]' . "\n"; 495 501 496 # uploaded files 497 RewriteRule ^' . ( $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?' ) . 'files/(.+) wp-includes/ms-files.php?file=$' . ( $subdomain_install ? 1 : 2 ) . ' [L]' . "\n"; 502 if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) { 503 $htaccess_file .= "\n\n# uploaded files\nRewriteRule ^"; 504 $htaccess_file .= ( $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?' ) . 'files/(.+) wp-includes/ms-files.php?file=$' . ( $subdomain_install ? 1 : 2 ) . ' [L]' . "\n"; 505 } 498 506 499 507 if ( ! $subdomain_install ) 500 508 $htaccess_file .= "\n# add a trailing slash to /wp-admin\n" . 'RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]' . "\n"; … … 511 519 512 520 ?> 513 521 <li><p><?php printf( __( 'Add the following to your <code>.htaccess</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p> 514 <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $subdomain_install ? 11 : 16; ?>"> 522 <?php 523 if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' ) 524 echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>'; 525 ?> 526 <textarea class="code" readonly="readonly" cols="100" rows="<?php echo substr_count( $htaccess_file, "\n" ) + 1; ?>"> 515 527 <?php echo esc_textarea( $htaccess_file ); ?></textarea></li> 516 528 </ol> 517 529 -
wp-admin/includes/ms-deprecated.php
73 73 function wpmu_get_blog_allowedthemes( $blog_id = 0 ) { 74 74 _deprecated_function( __FUNCTION__, '3.4', 'WP_Theme::get_allowed_on_site()' ); 75 75 return array_map( 'intval', WP_Theme::get_allowed_on_site( $blog_id ) ); 76 } 77 No newline at end of file 76 } 77 78 function ms_deprecated_blogs_file() {} 79 No newline at end of file -
wp-admin/includes/upgrade.php
1308 1308 delete_site_option( 'allowed_themes' ); 1309 1309 } 1310 1310 } 1311 1312 if ( $wp_current_db_version < 20600 ) 1313 update_site_option( 'ms_files_rewriting', '1' ); 1311 1314 } 1312 1315 1313 1316 // The functions we use to actually do stuff -
wp-admin/includes/schema.php
901 901 'upload_space_check_disabled' => '0', 902 902 'subdomain_install' => intval( $subdomain_install ), 903 903 'global_terms_enabled' => global_terms_enabled() ? '1' : '0', 904 'ms_files_rewriting' => is_multisite() ? get_site_option( 'ms_files_rewriting' ) : '0', 904 905 'initial_db_version' => get_option( 'initial_db_version' ), 905 906 'active_sitewide_plugins' => array(), 906 907 ); … … 928 929 $blog_id = $wpdb->insert_id; 929 930 update_user_meta( $site_user->ID, 'source_domain', $domain ); 930 931 update_user_meta( $site_user->ID, 'primary_blog', $blog_id ); 931 if ( !$upload_path = get_option( 'upload_path' ) ) {932 $upload_path = substr( WP_CONTENT_DIR, strlen( ABSPATH ) ) . '/uploads';933 update_option( 'upload_path', $upload_path );934 }935 update_option( 'fileupload_url', get_option( 'siteurl' ) . '/' . $upload_path );936 932 } 937 933 938 934 if ( $subdomain_install ) -
wp-admin/includes/ms.php
90 90 91 91 $wpdb->delete( $wpdb->blogs, array( 'blog_id' => $blog_id ) ); 92 92 93 $dir = apply_filters( 'wpmu_delete_blog_upload_dir', WP_CONTENT_DIR . "/blogs.dir/{$blog_id}/files/", $blog_id ); 93 $uploads = wp_upload_dir(); 94 $dir = apply_filters( 'wpmu_delete_blog_upload_dir', $uploads['basedir'], $blog_id ); 94 95 $dir = rtrim( $dir, DIRECTORY_SEPARATOR ); 95 96 $top_dir = $dir; 96 97 $stack = array($dir); … … 347 348 function get_space_used() { 348 349 // Allow for an alternative way of tracking storage space used 349 350 $space_used = apply_filters( 'pre_get_space_used', false ); 350 if ( false === $space_used ) 351 $space_used = get_dirsize( BLOGUPLOADDIR ); 351 if ( false === $space_used ) { 352 $upload_dir = wp_upload_dir(); 353 $space_used = get_dirsize( $upload_dir['basedir'] ); 354 } 352 355 353 356 return $space_used; 354 357 } … … 665 668 <?php 666 669 } 667 670 668 function ms_deprecated_blogs_file() {669 if ( ! is_super_admin() )670 return;671 if ( ! file_exists( WP_CONTENT_DIR . '/blogs.php' ) )672 return;673 echo '<div class="update-nag">' . sprintf( __( 'The <code>%1$s</code> file is deprecated. Please remove it and update your server rewrite rules to use <code>%2$s</code> instead.' ), 'wp-content/blogs.php', 'wp-includes/ms-files.php' ) . '</div>';674 }675 add_action( 'network_admin_notices', 'ms_deprecated_blogs_file' );676 677 671 /** 678 672 * Grants super admin privileges. 679 673 *