mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Remove ms-files.php rewriting from WordPress multisite. fixes #19235.
Keep existing networks compatible with a ms_files_rewriting network option. git-svn-id: http://core.svn.wordpress.org/trunk@21823 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
bc6087bc98
commit
dc49f24a6c
@ -73,4 +73,6 @@ function get_site_allowed_themes() {
|
||||
function wpmu_get_blog_allowedthemes( $blog_id = 0 ) {
|
||||
_deprecated_function( __FUNCTION__, '3.4', 'WP_Theme::get_allowed_on_site()' );
|
||||
return array_map( 'intval', WP_Theme::get_allowed_on_site( $blog_id ) );
|
||||
}
|
||||
}
|
||||
|
||||
function ms_deprecated_blogs_file() {}
|
@ -90,7 +90,8 @@ function wpmu_delete_blog( $blog_id, $drop = false ) {
|
||||
|
||||
$wpdb->delete( $wpdb->blogs, array( 'blog_id' => $blog_id ) );
|
||||
|
||||
$dir = apply_filters( 'wpmu_delete_blog_upload_dir', WP_CONTENT_DIR . "/blogs.dir/{$blog_id}/files/", $blog_id );
|
||||
$uploads = wp_upload_dir();
|
||||
$dir = apply_filters( 'wpmu_delete_blog_upload_dir', $uploads['basedir'], $blog_id );
|
||||
$dir = rtrim( $dir, DIRECTORY_SEPARATOR );
|
||||
$top_dir = $dir;
|
||||
$stack = array($dir);
|
||||
@ -357,8 +358,10 @@ function upload_is_user_over_quota( $echo = true ) {
|
||||
function get_space_used() {
|
||||
// Allow for an alternative way of tracking storage space used
|
||||
$space_used = apply_filters( 'pre_get_space_used', false );
|
||||
if ( false === $space_used )
|
||||
$space_used = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024;
|
||||
if ( false === $space_used ) {
|
||||
$upload_dir = wp_upload_dir();
|
||||
$space_used = get_dirsize( $upload_dir['basedir'] ) / 1024 / 1024;
|
||||
}
|
||||
|
||||
return $space_used;
|
||||
}
|
||||
@ -682,15 +685,6 @@ function choose_primary_blog() {
|
||||
<?php
|
||||
}
|
||||
|
||||
function ms_deprecated_blogs_file() {
|
||||
if ( ! is_super_admin() )
|
||||
return;
|
||||
if ( ! file_exists( WP_CONTENT_DIR . '/blogs.php' ) )
|
||||
return;
|
||||
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>';
|
||||
}
|
||||
add_action( 'network_admin_notices', 'ms_deprecated_blogs_file' );
|
||||
|
||||
/**
|
||||
* Grants super admin privileges.
|
||||
*
|
||||
|
@ -912,6 +912,7 @@ We hope you enjoy your new site. Thanks!
|
||||
'upload_space_check_disabled' => '0',
|
||||
'subdomain_install' => intval( $subdomain_install ),
|
||||
'global_terms_enabled' => global_terms_enabled() ? '1' : '0',
|
||||
'ms_files_rewriting' => is_multisite() ? get_site_option( 'ms_files_rewriting' ) : '0',
|
||||
'initial_db_version' => get_option( 'initial_db_version' ),
|
||||
'active_sitewide_plugins' => array(),
|
||||
);
|
||||
@ -940,11 +941,6 @@ We hope you enjoy your new site. Thanks!
|
||||
$blog_id = $wpdb->insert_id;
|
||||
update_user_meta( $site_user->ID, 'source_domain', $domain );
|
||||
update_user_meta( $site_user->ID, 'primary_blog', $blog_id );
|
||||
if ( !$upload_path = get_option( 'upload_path' ) ) {
|
||||
$upload_path = substr( WP_CONTENT_DIR, strlen( ABSPATH ) ) . '/uploads';
|
||||
update_option( 'upload_path', $upload_path );
|
||||
}
|
||||
update_option( 'fileupload_url', get_option( 'siteurl' ) . '/' . $upload_path );
|
||||
}
|
||||
|
||||
if ( $subdomain_install )
|
||||
|
@ -1271,6 +1271,10 @@ function upgrade_network() {
|
||||
delete_site_option( 'allowed_themes' );
|
||||
}
|
||||
}
|
||||
|
||||
// 3.5
|
||||
if ( $wp_current_db_version < 21823 )
|
||||
update_site_option( 'ms_files_rewriting', '1' );
|
||||
}
|
||||
|
||||
// The functions we use to actually do stuff
|
||||
|
@ -106,7 +106,7 @@ if ( is_network_admin() ) {
|
||||
$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>' .
|
||||
'<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>' .
|
||||
'<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>' .
|
||||
'<p>' . __('Add a <code>blogs.dir</code> directory under <code>/wp-content</code> and 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>' .
|
||||
'<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>' .
|
||||
'<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>' .
|
||||
'<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>' .
|
||||
'<p><strong>' . __('For more information:') . '</strong></p>' .
|
||||
@ -190,9 +190,6 @@ function network_step1( $errors = false ) {
|
||||
$error_codes = $errors->get_error_codes();
|
||||
}
|
||||
|
||||
if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' )
|
||||
echo '<div class="error"><p><strong>' . __('Warning!') . '</strong> ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>';
|
||||
|
||||
$site_name = ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes ) ) ? $_POST['sitename'] : sprintf( _x('%s Sites', 'Default network name' ), get_option( 'blogname' ) );
|
||||
$admin_email = ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes ) ) ? $_POST['email'] : get_option( 'admin_email' );
|
||||
?>
|
||||
@ -235,6 +232,9 @@ function network_step1( $errors = false ) {
|
||||
<?php
|
||||
endif;
|
||||
|
||||
if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' && ( allow_subdirectory_install() || ! allow_subdomain_install() ) )
|
||||
echo '<div class="error inline"><p><strong>' . __('Warning!') . '</strong> ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>';
|
||||
|
||||
$is_www = ( 0 === strpos( $hostname, 'www.' ) );
|
||||
if ( $is_www ) :
|
||||
?>
|
||||
@ -360,11 +360,6 @@ function network_step2( $errors = false ) {
|
||||
}
|
||||
?>
|
||||
<ol>
|
||||
<li><p><?php
|
||||
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 );
|
||||
if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' )
|
||||
echo ' <strong>' . __('Warning:') . ' ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '</strong>';
|
||||
?></p></li>
|
||||
<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>
|
||||
<textarea class="code" readonly="readonly" cols="100" rows="7">
|
||||
define('MULTISITE', true);
|
||||
@ -415,12 +410,16 @@ define('BLOG_ID_CURRENT_SITE', 1);</textarea>
|
||||
<rule name="WordPress Rule 1" stopProcessing="true">
|
||||
<match url="^index\.php$" ignoreCase="false" />
|
||||
<action type="None" />
|
||||
</rule>
|
||||
<rule name="WordPress Rule 2" stopProcessing="true">
|
||||
</rule>';
|
||||
if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {
|
||||
$web_config_file .= '
|
||||
<rule name="WordPress Rule for Files" stopProcessing="true">
|
||||
<match url="^files/(.+)" ignoreCase="false" />
|
||||
<action type="Rewrite" url="wp-includes/ms-files.php?file={R:1}" appendQueryString="false" />
|
||||
</rule>
|
||||
<rule name="WordPress Rule 3" stopProcessing="true">
|
||||
</rule>';
|
||||
}
|
||||
$web_config_file .= '
|
||||
<rule name="WordPress Rule 2" stopProcessing="true">
|
||||
<match url="^" ignoreCase="false" />
|
||||
<conditions logicalGrouping="MatchAny">
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
|
||||
@ -428,7 +427,7 @@ define('BLOG_ID_CURRENT_SITE', 1);</textarea>
|
||||
</conditions>
|
||||
<action type="None" />
|
||||
</rule>
|
||||
<rule name="WordPress Rule 4" stopProcessing="true">
|
||||
<rule name="WordPress Rule 3" stopProcessing="true">
|
||||
<match url="." ignoreCase="false" />
|
||||
<action type="Rewrite" url="index.php" />
|
||||
</rule>
|
||||
@ -446,16 +445,20 @@ define('BLOG_ID_CURRENT_SITE', 1);</textarea>
|
||||
<rule name="WordPress Rule 1" stopProcessing="true">
|
||||
<match url="^index\.php$" ignoreCase="false" />
|
||||
<action type="None" />
|
||||
</rule>
|
||||
</rule>';
|
||||
if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {
|
||||
$web_config_file .= '
|
||||
<rule name="WordPress Rule for Files" stopProcessing="true">
|
||||
<match url="^files/(.+)" ignoreCase="false" />
|
||||
<action type="Rewrite" url="wp-includes/ms-files.php?file={R:1}" appendQueryString="false" />
|
||||
</rule>';
|
||||
}
|
||||
$web_config_file .= '
|
||||
<rule name="WordPress Rule 2" stopProcessing="true">
|
||||
<match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" />
|
||||
<action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" />
|
||||
</rule>
|
||||
<rule name="WordPress Rule 3" stopProcessing="true">
|
||||
<match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />
|
||||
<action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />
|
||||
</rule>
|
||||
<rule name="WordPress Rule 4" stopProcessing="true">
|
||||
<rule name="WordPress Rule 3" stopProcessing="true">
|
||||
<match url="^" ignoreCase="false" />
|
||||
<conditions logicalGrouping="MatchAny">
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
|
||||
@ -463,15 +466,15 @@ define('BLOG_ID_CURRENT_SITE', 1);</textarea>
|
||||
</conditions>
|
||||
<action type="None" />
|
||||
</rule>
|
||||
<rule name="WordPress Rule 5" stopProcessing="true">
|
||||
<rule name="WordPress Rule 4" stopProcessing="true">
|
||||
<match url="^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*)" ignoreCase="false" />
|
||||
<action type="Rewrite" url="{R:1}" />
|
||||
</rule>
|
||||
<rule name="WordPress Rule 6" stopProcessing="true">
|
||||
<rule name="WordPress Rule 5" stopProcessing="true">
|
||||
<match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
|
||||
<action type="Rewrite" url="{R:2}" />
|
||||
</rule>
|
||||
<rule name="WordPress Rule 7" stopProcessing="true">
|
||||
<rule name="WordPress Rule 6" stopProcessing="true">
|
||||
<match url="." ignoreCase="false" />
|
||||
<action type="Rewrite" url="index.php" />
|
||||
</rule>
|
||||
@ -482,8 +485,11 @@ define('BLOG_ID_CURRENT_SITE', 1);</textarea>
|
||||
}
|
||||
?>
|
||||
<li><p><?php printf( __( 'Add the following to your <code>web.config</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p>
|
||||
<textarea class="code" readonly="readonly" cols="100" rows="20">
|
||||
<?php echo esc_textarea( $web_config_file ); ?>
|
||||
<?php
|
||||
if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' )
|
||||
echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
|
||||
?>
|
||||
<textarea class="code" readonly="readonly" cols="100" rows="20"><?php echo esc_textarea( $web_config_file ); ?>
|
||||
</textarea></li>
|
||||
</ol>
|
||||
|
||||
@ -491,10 +497,12 @@ define('BLOG_ID_CURRENT_SITE', 1);</textarea>
|
||||
|
||||
$htaccess_file = 'RewriteEngine On
|
||||
RewriteBase ' . $base . '
|
||||
RewriteRule ^index\.php$ - [L]
|
||||
RewriteRule ^index\.php$ - [L]' . "\n";
|
||||
|
||||
# uploaded files
|
||||
RewriteRule ^' . ( $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?' ) . 'files/(.+) wp-includes/ms-files.php?file=$' . ( $subdomain_install ? 1 : 2 ) . ' [L]' . "\n";
|
||||
if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {
|
||||
$htaccess_file .= "\n# uploaded files\nRewriteRule ^";
|
||||
$htaccess_file .= ( $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?' ) . 'files/(.+) wp-includes/ms-files.php?file=$' . ( $subdomain_install ? 1 : 2 ) . ' [L]' . "\n";
|
||||
}
|
||||
|
||||
if ( ! $subdomain_install )
|
||||
$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,7 +519,11 @@ RewriteRule ^ - [L]';
|
||||
|
||||
?>
|
||||
<li><p><?php printf( __( 'Add the following to your <code>.htaccess</code> file in <code>%s</code>, replacing other WordPress rules:' ), ABSPATH ); ?></p>
|
||||
<textarea class="code" readonly="readonly" cols="100" rows="<?php echo $subdomain_install ? 11 : 16; ?>">
|
||||
<?php
|
||||
if ( ! $subdomain_install && WP_CONTENT_DIR != ABSPATH . 'wp-content' )
|
||||
echo '<p><strong>' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>';
|
||||
?>
|
||||
<textarea class="code" readonly="readonly" cols="100" rows="<?php echo substr_count( $htaccess_file, "\n" ) + 1; ?>">
|
||||
<?php echo esc_textarea( $htaccess_file ); ?></textarea></li>
|
||||
</ol>
|
||||
|
||||
|
@ -1432,21 +1432,16 @@ function get_temp_dir() {
|
||||
* @return array See above for description.
|
||||
*/
|
||||
function wp_upload_dir( $time = null ) {
|
||||
global $_wp_switched;
|
||||
$siteurl = get_option( 'siteurl' );
|
||||
$upload_path = get_option( 'upload_path' );
|
||||
$upload_path = trim($upload_path);
|
||||
$main_override = is_multisite() && defined( 'MULTISITE' ) && is_main_site();
|
||||
if ( empty($upload_path) ) {
|
||||
$upload_path = trim( get_option( 'upload_path' ) );
|
||||
|
||||
if ( empty( $upload_path ) || 'wp-content/uploads' == $upload_path ) {
|
||||
$dir = WP_CONTENT_DIR . '/uploads';
|
||||
} elseif ( 0 !== strpos( $upload_path, ABSPATH ) ) {
|
||||
// $dir is absolute, $upload_path is (maybe) relative to ABSPATH
|
||||
$dir = path_join( ABSPATH, $upload_path );
|
||||
} else {
|
||||
$dir = $upload_path;
|
||||
if ( 'wp-content/uploads' == $upload_path ) {
|
||||
$dir = WP_CONTENT_DIR . '/uploads';
|
||||
} elseif ( 0 !== strpos($dir, ABSPATH) ) {
|
||||
// $dir is absolute, $upload_path is (maybe) relative to ABSPATH
|
||||
$dir = path_join( ABSPATH, $dir );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !$url = get_option( 'upload_url_path' ) ) {
|
||||
@ -1456,15 +1451,24 @@ function wp_upload_dir( $time = null ) {
|
||||
$url = trailingslashit( $siteurl ) . $upload_path;
|
||||
}
|
||||
|
||||
if ( defined('UPLOADS') && ! $main_override && ! $_wp_switched ) {
|
||||
if ( defined( 'UPLOADS' ) ) {
|
||||
$dir = ABSPATH . UPLOADS;
|
||||
$url = trailingslashit( $siteurl ) . UPLOADS;
|
||||
}
|
||||
|
||||
if ( is_multisite() && ! $main_override && ! $_wp_switched ) {
|
||||
if ( defined( 'BLOGUPLOADDIR' ) )
|
||||
$dir = untrailingslashit(BLOGUPLOADDIR);
|
||||
$url = str_replace( UPLOADS, 'files', $url );
|
||||
// Multisite (if not the main site in a post-MU network)
|
||||
if ( is_multisite() && ! ( is_main_site() && defined( 'MULTISITE' ) ) ) {
|
||||
if ( ! get_site_option( 'ms_files_rewriting' ) ) {
|
||||
// Append sites/%d if we're not on the main site (for post-MU networks).
|
||||
$ms_dir = '/sites/' . get_current_blog_id();
|
||||
$dir .= $ms_dir;
|
||||
$url .= $ms_dir;
|
||||
} elseif ( ! ms_is_switched() ) {
|
||||
// Handle the old-form ms-files.php rewriting if the network still has that enabled.
|
||||
if ( defined( 'BLOGUPLOADDIR' ) )
|
||||
$dir = untrailingslashit( BLOGUPLOADDIR );
|
||||
$url = str_replace( UPLOADS, 'files', $url );
|
||||
}
|
||||
}
|
||||
|
||||
$basedir = $dir;
|
||||
|
@ -10,11 +10,17 @@
|
||||
/**
|
||||
* Defines Multisite upload constants.
|
||||
*
|
||||
* Exists for backward compatibility with legacy file-serving through
|
||||
* wp-includes/ms-files.php (wp-content/blogs.php in MU).
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function ms_upload_constants( ) {
|
||||
function ms_upload_constants() {
|
||||
global $wpdb;
|
||||
|
||||
if ( ! get_site_option( 'ms_files_rewriting' ) )
|
||||
return;
|
||||
|
||||
/** @since 3.0.0 */
|
||||
// Base uploads dir relative to ABSPATH
|
||||
if ( !defined( 'UPLOADBLOGSDIR' ) )
|
||||
@ -24,7 +30,7 @@ function ms_upload_constants( ) {
|
||||
if ( !defined( 'UPLOADS' ) ) {
|
||||
// Uploads dir relative to ABSPATH
|
||||
define( 'UPLOADS', UPLOADBLOGSDIR . "/{$wpdb->blogid}/files/" );
|
||||
if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR )
|
||||
if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR && ! defined( 'BLOGUPLOADDIR' ) )
|
||||
define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . "/blogs.dir/{$wpdb->blogid}/files/" );
|
||||
}
|
||||
}
|
||||
@ -74,9 +80,12 @@ function ms_cookie_constants( ) {
|
||||
/**
|
||||
* Defines Multisite file constants.
|
||||
*
|
||||
* Exists for backward compatibility with legacy file-serving through
|
||||
* wp-includes/ms-files.php (wp-content/blogs.php in MU).
|
||||
*
|
||||
* @since 3.0.0
|
||||
*/
|
||||
function ms_file_constants( ) {
|
||||
function ms_file_constants() {
|
||||
/**
|
||||
* Optional support for X-Sendfile header
|
||||
* @since 3.0.0
|
||||
|
@ -61,3 +61,6 @@ add_filter( 'force_filtered_html_on_import', '__return_true' );
|
||||
// WP_HOME and WP_SITEURL should not have any effect in MS
|
||||
remove_filter( 'option_siteurl', '_config_wp_siteurl' );
|
||||
remove_filter( 'option_home', '_config_wp_home' );
|
||||
|
||||
// If the network upgrade hasn't run yet, assume ms-files.php rewriting is used.
|
||||
add_filter( 'default_site_option_ms_files_rewriting', '__return_true' );
|
@ -1120,8 +1120,7 @@ function insert_blog($domain, $path, $site_id) {
|
||||
* @param string $blog_title The title of the new site.
|
||||
*/
|
||||
function install_blog($blog_id, $blog_title = '') {
|
||||
global $wpdb, $table_prefix, $wp_roles;
|
||||
$wpdb->suppress_errors();
|
||||
global $wpdb, $wp_roles, $current_site;
|
||||
|
||||
// Cast for security
|
||||
$blog_id = (int) $blog_id;
|
||||
@ -1129,11 +1128,9 @@ function install_blog($blog_id, $blog_title = '') {
|
||||
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
||||
|
||||
if ( $wpdb->get_results("SELECT ID FROM $wpdb->posts") )
|
||||
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>');
|
||||
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>' );
|
||||
|
||||
$wpdb->suppress_errors(false);
|
||||
|
||||
$url = get_blogaddress_by_id($blog_id);
|
||||
$url = get_blogaddress_by_id( $blog_id );
|
||||
|
||||
// Set everything up
|
||||
make_db_current_silent( 'blog' );
|
||||
@ -1142,21 +1139,22 @@ function install_blog($blog_id, $blog_title = '') {
|
||||
$wp_roles->_init();
|
||||
|
||||
$url = untrailingslashit( $url );
|
||||
// fix url.
|
||||
update_option('siteurl', $url);
|
||||
update_option('home', $url);
|
||||
update_option('fileupload_url', $url . "/files" );
|
||||
update_option('upload_path', UPLOADBLOGSDIR . "/$blog_id/files");
|
||||
update_option('blogname', stripslashes( $blog_title ) );
|
||||
update_option('admin_email', '');
|
||||
$wpdb->update( $wpdb->options, array('option_value' => ''), array('option_name' => 'admin_email') );
|
||||
|
||||
update_option( 'siteurl', $url );
|
||||
update_option( 'home', $url );
|
||||
|
||||
if ( get_site_option( 'ms_files_rewriting' ) )
|
||||
update_option( 'upload_path', UPLOADBLOGSDIR . "/$blog_id/files" );
|
||||
else
|
||||
update_option( 'upload_path', get_blog_option( $current_site->blog_id, 'upload_path' ) );
|
||||
|
||||
update_option( 'blogname', stripslashes( $blog_title ) );
|
||||
update_option( 'admin_email', '' );
|
||||
|
||||
// remove all perms
|
||||
$wpdb->delete( $wpdb->usermeta, array( 'meta_key' => $table_prefix.'user_level' ) );
|
||||
|
||||
$wpdb->delete( $wpdb->usermeta, array( 'meta_key' => $table_prefix.'capabilities' ) );
|
||||
|
||||
$wpdb->suppress_errors( false );
|
||||
$table_prefix = $wpdb->get_blog_prefix();
|
||||
delete_metadata( 'user', 0, $table_prefix . 'user_level', null, true ); // delete all
|
||||
delete_metadata( 'user', 0, $table_prefix . 'capabilities', null, true ); // delete all
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -174,7 +174,7 @@ function wp_load_core_site_options( $site_id = null ) {
|
||||
if ( empty($site_id) )
|
||||
$site_id = $wpdb->siteid;
|
||||
|
||||
$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' );
|
||||
$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' );
|
||||
|
||||
$core_options_in = "'" . implode("', '", $core_options) . "'";
|
||||
$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) );
|
||||
|
@ -1742,15 +1742,19 @@ class WP_Rewrite {
|
||||
} else {
|
||||
if (is_subdomain_install()) {
|
||||
$rules .= '
|
||||
<rule name="wordpress - Rule 1" stopProcessing="true">
|
||||
<rule name="WordPress Rule 1" stopProcessing="true">
|
||||
<match url="^index\.php$" ignoreCase="false" />
|
||||
<action type="None" />
|
||||
</rule>
|
||||
<rule name="wordpress - Rule 2" stopProcessing="true">
|
||||
</rule>';
|
||||
if ( get_site_option( 'ms_files_rewriting' ) ) {
|
||||
$rules .= '
|
||||
<rule name="WordPress Rule for Files" stopProcessing="true">
|
||||
<match url="^files/(.+)" ignoreCase="false" />
|
||||
<action type="Rewrite" url="wp-includes/ms-files.php?file={R:1}" appendQueryString="false" />
|
||||
</rule>
|
||||
<rule name="wordpress - Rule 3" stopProcessing="true">
|
||||
</rule>';
|
||||
}
|
||||
$rules .= '
|
||||
<rule name="WordPress Rule 2" stopProcessing="true">
|
||||
<match url="^" ignoreCase="false" />
|
||||
<conditions logicalGrouping="MatchAny">
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
|
||||
@ -1758,25 +1762,29 @@ class WP_Rewrite {
|
||||
</conditions>
|
||||
<action type="None" />
|
||||
</rule>
|
||||
<rule name="wordpress - Rule 4" stopProcessing="true">
|
||||
<rule name="WordPress Rule 3" stopProcessing="true">
|
||||
<match url="." ignoreCase="false" />
|
||||
<action type="Rewrite" url="index.php" />
|
||||
</rule>';
|
||||
} else {
|
||||
$rules .= '
|
||||
<rule name="wordpress - Rule 1" stopProcessing="true">
|
||||
<rule name="WordPress Rule 1" stopProcessing="true">
|
||||
<match url="^index\.php$" ignoreCase="false" />
|
||||
<action type="None" />
|
||||
</rule>
|
||||
<rule name="wordpress - Rule 2" stopProcessing="true">
|
||||
</rule>';
|
||||
if ( get_site_option( 'ms_files_rewriting' ) ) {
|
||||
$rules .= '
|
||||
<rule name="WordPress Rule for Files" stopProcessing="true">
|
||||
<match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" />
|
||||
<action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" />
|
||||
</rule>
|
||||
<rule name="wordpress - Rule 3" stopProcessing="true">
|
||||
</rule>';
|
||||
}
|
||||
$rules .= '
|
||||
<rule name="WordPress Rule 2" stopProcessing="true">
|
||||
<match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />
|
||||
<action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />
|
||||
</rule>
|
||||
<rule name="wordpress - Rule 4" stopProcessing="true">
|
||||
<rule name="WordPress Rule 3" stopProcessing="true">
|
||||
<match url="^" ignoreCase="false" />
|
||||
<conditions logicalGrouping="MatchAny">
|
||||
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
|
||||
@ -1784,15 +1792,15 @@ class WP_Rewrite {
|
||||
</conditions>
|
||||
<action type="None" />
|
||||
</rule>
|
||||
<rule name="wordpress - Rule 5" stopProcessing="true">
|
||||
<rule name="WordPress Rule 4" stopProcessing="true">
|
||||
<match url="^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />
|
||||
<action type="Rewrite" url="{R:1}" />
|
||||
</rule>
|
||||
<rule name="wordpress - Rule 6" stopProcessing="true">
|
||||
<rule name="WordPress Rule 5" stopProcessing="true">
|
||||
<match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
|
||||
<action type="Rewrite" url="{R:2}" />
|
||||
</rule>
|
||||
<rule name="wordpress - Rule 7" stopProcessing="true">
|
||||
<rule name="WordPress Rule 6" stopProcessing="true">
|
||||
<match url="." ignoreCase="false" />
|
||||
<action type="Rewrite" url="index.php" />
|
||||
</rule>';
|
||||
|
@ -11,7 +11,7 @@ $wp_version = '3.5-alpha-21751';
|
||||
*
|
||||
* @global int $wp_db_version
|
||||
*/
|
||||
$wp_db_version = 21818;
|
||||
$wp_db_version = 21823;
|
||||
|
||||
/**
|
||||
* Holds the TinyMCE version
|
||||
|
Loading…
Reference in New Issue
Block a user