<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[21823] trunk: Remove ms-files.php rewriting from WordPress multisite.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/21823">21823</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2012-09-11 22:22:20 +0000 (Tue, 11 Sep 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove ms-files.php rewriting from WordPress multisite. fixes <a href="http://core.trac.wordpress.org/ticket/19235">#19235</a>.

Keep existing networks compatible with a ms_files_rewriting network option.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesmsdeprecatedphp">trunk/wp-admin/includes/ms-deprecated.php</a></li>
<li><a href="#trunkwpadminincludesmsphp">trunk/wp-admin/includes/ms.php</a></li>
<li><a href="#trunkwpadminincludesschemaphp">trunk/wp-admin/includes/schema.php</a></li>
<li><a href="#trunkwpadminincludesupgradephp">trunk/wp-admin/includes/upgrade.php</a></li>
<li><a href="#trunkwpadminnetworkphp">trunk/wp-admin/network.php</a></li>
<li><a href="#trunkwpincludesfunctionsphp">trunk/wp-includes/functions.php</a></li>
<li><a href="#trunkwpincludesmsdefaultconstantsphp">trunk/wp-includes/ms-default-constants.php</a></li>
<li><a href="#trunkwpincludesmsdefaultfiltersphp">trunk/wp-includes/ms-default-filters.php</a></li>
<li><a href="#trunkwpincludesmsfunctionsphp">trunk/wp-includes/ms-functions.php</a></li>
<li><a href="#trunkwpincludesoptionphp">trunk/wp-includes/option.php</a></li>
<li><a href="#trunkwpincludesrewritephp">trunk/wp-includes/rewrite.php</a></li>
<li><a href="#trunkwpincludesversionphp">trunk/wp-includes/version.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesmsdeprecatedphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/ms-deprecated.php (21822 => 21823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/ms-deprecated.php        2012-09-11 22:06:49 UTC (rev 21822)
+++ trunk/wp-admin/includes/ms-deprecated.php        2012-09-11 22:22:20 UTC (rev 21823)
</span><span class="lines">@@ -73,4 +73,6 @@
</span><span class="cx"> function wpmu_get_blog_allowedthemes( $blog_id = 0 ) {
</span><span class="cx">         _deprecated_function( __FUNCTION__, '3.4', 'WP_Theme::get_allowed_on_site()' );
</span><span class="cx">         return array_map( 'intval', WP_Theme::get_allowed_on_site( $blog_id ) );
</span><del>-}
</del><span class="cx">\ No newline at end of file
</span><ins>+}
+
+function ms_deprecated_blogs_file() {}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminincludesmsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/ms.php (21822 => 21823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/ms.php        2012-09-11 22:06:49 UTC (rev 21822)
+++ trunk/wp-admin/includes/ms.php        2012-09-11 22:22:20 UTC (rev 21823)
</span><span class="lines">@@ -90,7 +90,8 @@
</span><span class="cx"> 
</span><span class="cx">                 $wpdb-&gt;delete( $wpdb-&gt;blogs, array( 'blog_id' =&gt; $blog_id ) );
</span><span class="cx"> 
</span><del>-                $dir = apply_filters( 'wpmu_delete_blog_upload_dir', WP_CONTENT_DIR . &quot;/blogs.dir/{$blog_id}/files/&quot;, $blog_id );
</del><ins>+                $uploads = wp_upload_dir();
+                $dir = apply_filters( 'wpmu_delete_blog_upload_dir', $uploads['basedir'], $blog_id );
</ins><span class="cx">                 $dir = rtrim( $dir, DIRECTORY_SEPARATOR );
</span><span class="cx">                 $top_dir = $dir;
</span><span class="cx">                 $stack = array($dir);
</span><span class="lines">@@ -357,8 +358,10 @@
</span><span class="cx"> function get_space_used() {
</span><span class="cx">         // Allow for an alternative way of tracking storage space used
</span><span class="cx">         $space_used = apply_filters( 'pre_get_space_used', false );
</span><del>-        if ( false === $space_used )
-                $space_used = get_dirsize( BLOGUPLOADDIR ) / 1024 / 1024;
</del><ins>+        if ( false === $space_used ) {
+                $upload_dir = wp_upload_dir();
+                $space_used = get_dirsize( $upload_dir['basedir'] ) / 1024 / 1024;
+        }
</ins><span class="cx"> 
</span><span class="cx">         return $space_used;
</span><span class="cx"> }
</span><span class="lines">@@ -682,15 +685,6 @@
</span><span class="cx">         &lt;?php
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function ms_deprecated_blogs_file() {
-        if ( ! is_super_admin() )
-                return;
-        if ( ! file_exists( WP_CONTENT_DIR . '/blogs.php' ) )
-                return;
-        echo '&lt;div class=&quot;update-nag&quot;&gt;' . sprintf( __( 'The &lt;code&gt;%1$s&lt;/code&gt; file is deprecated. Please remove it and update your server rewrite rules to use &lt;code&gt;%2$s&lt;/code&gt; instead.' ), 'wp-content/blogs.php', 'wp-includes/ms-files.php' ) . '&lt;/div&gt;';
-}
-add_action( 'network_admin_notices', 'ms_deprecated_blogs_file' );
-
</del><span class="cx"> /**
</span><span class="cx">  * Grants super admin privileges.
</span><span class="cx">  *
</span></span></pre></div>
<a id="trunkwpadminincludesschemaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/schema.php (21822 => 21823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/schema.php        2012-09-11 22:06:49 UTC (rev 21822)
+++ trunk/wp-admin/includes/schema.php        2012-09-11 22:22:20 UTC (rev 21823)
</span><span class="lines">@@ -912,6 +912,7 @@
</span><span class="cx">                 'upload_space_check_disabled' =&gt; '0',
</span><span class="cx">                 'subdomain_install' =&gt; intval( $subdomain_install ),
</span><span class="cx">                 'global_terms_enabled' =&gt; global_terms_enabled() ? '1' : '0',
</span><ins>+                'ms_files_rewriting' =&gt; is_multisite() ? get_site_option( 'ms_files_rewriting' ) : '0',
</ins><span class="cx">                 'initial_db_version' =&gt; get_option( 'initial_db_version' ),
</span><span class="cx">                 'active_sitewide_plugins' =&gt; array(),
</span><span class="cx">         );
</span><span class="lines">@@ -940,11 +941,6 @@
</span><span class="cx">                 $blog_id = $wpdb-&gt;insert_id;
</span><span class="cx">                 update_user_meta( $site_user-&gt;ID, 'source_domain', $domain );
</span><span class="cx">                 update_user_meta( $site_user-&gt;ID, 'primary_blog', $blog_id );
</span><del>-                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 );
</del><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if ( $subdomain_install )
</span></span></pre></div>
<a id="trunkwpadminincludesupgradephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/upgrade.php (21822 => 21823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/upgrade.php        2012-09-11 22:06:49 UTC (rev 21822)
+++ trunk/wp-admin/includes/upgrade.php        2012-09-11 22:22:20 UTC (rev 21823)
</span><span class="lines">@@ -1271,6 +1271,10 @@
</span><span class="cx">                         delete_site_option( 'allowed_themes' );
</span><span class="cx">                 }
</span><span class="cx">         }
</span><ins>+
+        // 3.5
+        if ( $wp_current_db_version &lt; 21823 )
+                update_site_option( 'ms_files_rewriting', '1' );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // The functions we use to actually do stuff
</span></span></pre></div>
<a id="trunkwpadminnetworkphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/network.php (21822 => 21823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/network.php        2012-09-11 22:06:49 UTC (rev 21822)
+++ trunk/wp-admin/network.php        2012-09-11 22:22:20 UTC (rev 21823)
</span><span class="lines">@@ -106,7 +106,7 @@
</span><span class="cx"> $network_help = '&lt;p&gt;' . __('This screen allows you to configure a network as having subdomains (&lt;code&gt;site1.example.com&lt;/code&gt;) or subdirectories (&lt;code&gt;example.com/site1&lt;/code&gt;). Subdomains require wildcard subdomains to be enabled in Apache and DNS records, if your host allows it.') . '&lt;/p&gt;' .
</span><span class="cx">         '&lt;p&gt;' . __('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).') . '&lt;/p&gt;' .
</span><span class="cx">         '&lt;p&gt;' . __('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.') . '&lt;/p&gt;' .
</span><del>-        '&lt;p&gt;' . __('Add a &lt;code&gt;blogs.dir&lt;/code&gt; directory under &lt;code&gt;/wp-content&lt;/code&gt; and add the designated lines of code to wp-config.php (just before &lt;code&gt;/*...stop editing...*/&lt;/code&gt;) and &lt;code&gt;.htaccess&lt;/code&gt; (replacing the existing WordPress rules).') . '&lt;/p&gt;' .
</del><ins>+        '&lt;p&gt;' . __('Add the designated lines of code to wp-config.php (just before &lt;code&gt;/*...stop editing...*/&lt;/code&gt;) and &lt;code&gt;.htaccess&lt;/code&gt; (replacing the existing WordPress rules).') . '&lt;/p&gt;' .
</ins><span class="cx">         '&lt;p&gt;' . __('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.') . '&lt;/p&gt;' .
</span><span class="cx">         '&lt;p&gt;' . __('The choice of subdirectory sites is disabled if this setup is more than a month old because of permalink problems with &amp;#8220;/blog/&amp;#8221; from the main site. This disabling will be addressed in a future version.') . '&lt;/p&gt;' .
</span><span class="cx">         '&lt;p&gt;&lt;strong&gt;' . __('For more information:') . '&lt;/strong&gt;&lt;/p&gt;' .
</span><span class="lines">@@ -190,9 +190,6 @@
</span><span class="cx">                 $error_codes = $errors-&gt;get_error_codes();
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' )
-                echo '&lt;div class=&quot;error&quot;&gt;&lt;p&gt;&lt;strong&gt;' . __('Warning!') . '&lt;/strong&gt; ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '&lt;/p&gt;&lt;/div&gt;';
-
</del><span class="cx">         $site_name = ( ! empty( $_POST['sitename'] ) &amp;&amp; ! in_array( 'empty_sitename', $error_codes ) ) ? $_POST['sitename'] : sprintf( _x('%s Sites', 'Default network name' ), get_option( 'blogname' ) );
</span><span class="cx">         $admin_email = ( ! empty( $_POST['email'] ) &amp;&amp; ! in_array( 'invalid_email', $error_codes ) ) ? $_POST['email'] : get_option( 'admin_email' );
</span><span class="cx">         ?&gt;
</span><span class="lines">@@ -235,6 +232,9 @@
</span><span class="cx"> &lt;?php
</span><span class="cx">         endif;
</span><span class="cx"> 
</span><ins>+                if ( WP_CONTENT_DIR != ABSPATH . 'wp-content' &amp;&amp; ( allow_subdirectory_install() || ! allow_subdomain_install() ) )
+                        echo '&lt;div class=&quot;error inline&quot;&gt;&lt;p&gt;&lt;strong&gt;' . __('Warning!') . '&lt;/strong&gt; ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '&lt;/p&gt;&lt;/div&gt;';
+
</ins><span class="cx">                 $is_www = ( 0 === strpos( $hostname, 'www.' ) );
</span><span class="cx">                 if ( $is_www ) :
</span><span class="cx">                 ?&gt;
</span><span class="lines">@@ -360,11 +360,6 @@
</span><span class="cx">         }
</span><span class="cx"> ?&gt;
</span><span class="cx">                 &lt;ol&gt;
</span><del>-                        &lt;li&gt;&lt;p&gt;&lt;?php
-                                printf( __( 'Create a &lt;code&gt;blogs.dir&lt;/code&gt; directory at &lt;code&gt;%s/blogs.dir&lt;/code&gt;. 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 ' &lt;strong&gt;' . __('Warning:') . ' ' . __( 'Networks may not be fully compatible with custom wp-content directories.' ) . '&lt;/strong&gt;';
-                        ?&gt;&lt;/p&gt;&lt;/li&gt;
</del><span class="cx">                         &lt;li&gt;&lt;p&gt;&lt;?php printf( __( 'Add the following to your &lt;code&gt;wp-config.php&lt;/code&gt; file in &lt;code&gt;%s&lt;/code&gt; &lt;strong&gt;above&lt;/strong&gt; the line reading &lt;code&gt;/* That&amp;#8217;s all, stop editing! Happy blogging. */&lt;/code&gt;:' ), ABSPATH ); ?&gt;&lt;/p&gt;
</span><span class="cx">                                 &lt;textarea class=&quot;code&quot; readonly=&quot;readonly&quot; cols=&quot;100&quot; rows=&quot;7&quot;&gt;
</span><span class="cx"> define('MULTISITE', true);
</span><span class="lines">@@ -415,12 +410,16 @@
</span><span class="cx">                 &lt;rule name=&quot;WordPress Rule 1&quot; stopProcessing=&quot;true&quot;&gt;
</span><span class="cx">                     &lt;match url=&quot;^index\.php$&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="cx">                     &lt;action type=&quot;None&quot; /&gt;
</span><del>-                &lt;/rule&gt;
-                &lt;rule name=&quot;WordPress Rule 2&quot; stopProcessing=&quot;true&quot;&gt;
</del><ins>+                &lt;/rule&gt;';
+                                if ( is_multisite() &amp;&amp; get_site_option( 'ms_files_rewriting' ) ) {
+                                        $web_config_file .= '
+                &lt;rule name=&quot;WordPress Rule for Files&quot; stopProcessing=&quot;true&quot;&gt;
</ins><span class="cx">                     &lt;match url=&quot;^files/(.+)&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="cx">                     &lt;action type=&quot;Rewrite&quot; url=&quot;wp-includes/ms-files.php?file={R:1}&quot; appendQueryString=&quot;false&quot; /&gt;
</span><del>-                &lt;/rule&gt;
-                &lt;rule name=&quot;WordPress Rule 3&quot; stopProcessing=&quot;true&quot;&gt;
</del><ins>+                &lt;/rule&gt;';
+                }
+                $web_config_file .= '
+                &lt;rule name=&quot;WordPress Rule 2&quot; stopProcessing=&quot;true&quot;&gt;
</ins><span class="cx">                     &lt;match url=&quot;^&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="cx">                     &lt;conditions logicalGrouping=&quot;MatchAny&quot;&gt;
</span><span class="cx">                         &lt;add input=&quot;{REQUEST_FILENAME}&quot; matchType=&quot;IsFile&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="lines">@@ -428,7 +427,7 @@
</span><span class="cx">                     &lt;/conditions&gt;
</span><span class="cx">                     &lt;action type=&quot;None&quot; /&gt;
</span><span class="cx">                 &lt;/rule&gt;
</span><del>-                &lt;rule name=&quot;WordPress Rule 4&quot; stopProcessing=&quot;true&quot;&gt;
</del><ins>+                &lt;rule name=&quot;WordPress Rule 3&quot; stopProcessing=&quot;true&quot;&gt;
</ins><span class="cx">                     &lt;match url=&quot;.&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="cx">                     &lt;action type=&quot;Rewrite&quot; url=&quot;index.php&quot; /&gt;
</span><span class="cx">                 &lt;/rule&gt;
</span><span class="lines">@@ -446,16 +445,20 @@
</span><span class="cx">                 &lt;rule name=&quot;WordPress Rule 1&quot; stopProcessing=&quot;true&quot;&gt;
</span><span class="cx">                     &lt;match url=&quot;^index\.php$&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="cx">                     &lt;action type=&quot;None&quot; /&gt;
</span><del>-                &lt;/rule&gt;
</del><ins>+                &lt;/rule&gt;';
+                                if ( is_multisite() &amp;&amp; get_site_option( 'ms_files_rewriting' ) ) {
+                                        $web_config_file .= '
+                &lt;rule name=&quot;WordPress Rule for Files&quot; stopProcessing=&quot;true&quot;&gt;
+                    &lt;match url=&quot;^files/(.+)&quot; ignoreCase=&quot;false&quot; /&gt;
+                    &lt;action type=&quot;Rewrite&quot; url=&quot;wp-includes/ms-files.php?file={R:1}&quot; appendQueryString=&quot;false&quot; /&gt;
+                &lt;/rule&gt;';
+                }
+                $web_config_file .= '
</ins><span class="cx">                 &lt;rule name=&quot;WordPress Rule 2&quot; stopProcessing=&quot;true&quot;&gt;
</span><del>-                    &lt;match url=&quot;^([_0-9a-zA-Z-]+/)?files/(.+)&quot; ignoreCase=&quot;false&quot; /&gt;
-                    &lt;action type=&quot;Rewrite&quot; url=&quot;wp-includes/ms-files.php?file={R:2}&quot; appendQueryString=&quot;false&quot; /&gt;
-                &lt;/rule&gt;
-                &lt;rule name=&quot;WordPress Rule 3&quot; stopProcessing=&quot;true&quot;&gt;
</del><span class="cx">                     &lt;match url=&quot;^([_0-9a-zA-Z-]+/)?wp-admin$&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="cx">                     &lt;action type=&quot;Redirect&quot; url=&quot;{R:1}wp-admin/&quot; redirectType=&quot;Permanent&quot; /&gt;
</span><span class="cx">                 &lt;/rule&gt;
</span><del>-                &lt;rule name=&quot;WordPress Rule 4&quot; stopProcessing=&quot;true&quot;&gt;
</del><ins>+                &lt;rule name=&quot;WordPress Rule 3&quot; stopProcessing=&quot;true&quot;&gt;
</ins><span class="cx">                     &lt;match url=&quot;^&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="cx">                     &lt;conditions logicalGrouping=&quot;MatchAny&quot;&gt;
</span><span class="cx">                         &lt;add input=&quot;{REQUEST_FILENAME}&quot; matchType=&quot;IsFile&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="lines">@@ -463,15 +466,15 @@
</span><span class="cx">                     &lt;/conditions&gt;
</span><span class="cx">                     &lt;action type=&quot;None&quot; /&gt;
</span><span class="cx">                 &lt;/rule&gt;
</span><del>-                &lt;rule name=&quot;WordPress Rule 5&quot; stopProcessing=&quot;true&quot;&gt;
</del><ins>+                &lt;rule name=&quot;WordPress Rule 4&quot; stopProcessing=&quot;true&quot;&gt;
</ins><span class="cx">                     &lt;match url=&quot;^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*)&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="cx">                     &lt;action type=&quot;Rewrite&quot; url=&quot;{R:1}&quot; /&gt;
</span><span class="cx">                 &lt;/rule&gt;
</span><del>-                &lt;rule name=&quot;WordPress Rule 6&quot; stopProcessing=&quot;true&quot;&gt;
</del><ins>+                &lt;rule name=&quot;WordPress Rule 5&quot; stopProcessing=&quot;true&quot;&gt;
</ins><span class="cx">                     &lt;match url=&quot;^([_0-9a-zA-Z-]+/)?(.*\.php)$&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="cx">                     &lt;action type=&quot;Rewrite&quot; url=&quot;{R:2}&quot; /&gt;
</span><span class="cx">                 &lt;/rule&gt;
</span><del>-                &lt;rule name=&quot;WordPress Rule 7&quot; stopProcessing=&quot;true&quot;&gt;
</del><ins>+                &lt;rule name=&quot;WordPress Rule 6&quot; stopProcessing=&quot;true&quot;&gt;
</ins><span class="cx">                     &lt;match url=&quot;.&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="cx">                     &lt;action type=&quot;Rewrite&quot; url=&quot;index.php&quot; /&gt;
</span><span class="cx">                 &lt;/rule&gt;
</span><span class="lines">@@ -482,8 +485,11 @@
</span><span class="cx">                         }
</span><span class="cx">         ?&gt;
</span><span class="cx">                 &lt;li&gt;&lt;p&gt;&lt;?php printf( __( 'Add the following to your &lt;code&gt;web.config&lt;/code&gt; file in &lt;code&gt;%s&lt;/code&gt;, replacing other WordPress rules:' ), ABSPATH ); ?&gt;&lt;/p&gt;
</span><del>-                &lt;textarea class=&quot;code&quot; readonly=&quot;readonly&quot; cols=&quot;100&quot; rows=&quot;20&quot;&gt;
-                &lt;?php echo esc_textarea( $web_config_file ); ?&gt;
</del><ins>+                &lt;?php
+                if ( ! $subdomain_install &amp;&amp; WP_CONTENT_DIR != ABSPATH . 'wp-content' )
+                        echo '&lt;p&gt;&lt;strong&gt;' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '&lt;/strong&gt;&lt;/p&gt;';
+                ?&gt;
+                &lt;textarea class=&quot;code&quot; readonly=&quot;readonly&quot; cols=&quot;100&quot; rows=&quot;20&quot;&gt;&lt;?php echo esc_textarea( $web_config_file ); ?&gt;
</ins><span class="cx">                 &lt;/textarea&gt;&lt;/li&gt;
</span><span class="cx">                 &lt;/ol&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -491,10 +497,12 @@
</span><span class="cx"> 
</span><span class="cx">                 $htaccess_file = 'RewriteEngine On
</span><span class="cx"> RewriteBase ' . $base . '
</span><del>-RewriteRule ^index\.php$ - [L]
</del><ins>+RewriteRule ^index\.php$ - [L]' . &quot;\n&quot;;
</ins><span class="cx"> 
</span><del>-# uploaded files
-RewriteRule ^' . ( $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?' ) . 'files/(.+) wp-includes/ms-files.php?file=$' . ( $subdomain_install ? 1 : 2 ) . ' [L]' . &quot;\n&quot;;
</del><ins>+                if ( is_multisite() &amp;&amp; get_site_option( 'ms_files_rewriting' ) ) {
+                        $htaccess_file .= &quot;\n# uploaded files\nRewriteRule ^&quot;;
+                        $htaccess_file .= ( $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?' ) . 'files/(.+) wp-includes/ms-files.php?file=$' . ( $subdomain_install ? 1 : 2 ) . ' [L]' . &quot;\n&quot;;
+                }
</ins><span class="cx"> 
</span><span class="cx">                 if ( ! $subdomain_install )
</span><span class="cx">                         $htaccess_file .= &quot;\n# add a trailing slash to /wp-admin\n&quot; . 'RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]' . &quot;\n&quot;;
</span><span class="lines">@@ -511,7 +519,11 @@
</span><span class="cx"> 
</span><span class="cx">                 ?&gt;
</span><span class="cx">                 &lt;li&gt;&lt;p&gt;&lt;?php printf( __( 'Add the following to your &lt;code&gt;.htaccess&lt;/code&gt; file in &lt;code&gt;%s&lt;/code&gt;, replacing other WordPress rules:' ), ABSPATH ); ?&gt;&lt;/p&gt;
</span><del>-                &lt;textarea class=&quot;code&quot; readonly=&quot;readonly&quot; cols=&quot;100&quot; rows=&quot;&lt;?php echo $subdomain_install ? 11 : 16; ?&gt;&quot;&gt;
</del><ins>+                &lt;?php
+                if ( ! $subdomain_install &amp;&amp; WP_CONTENT_DIR != ABSPATH . 'wp-content' )
+                        echo '&lt;p&gt;&lt;strong&gt;' . __('Warning:') . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '&lt;/strong&gt;&lt;/p&gt;';
+                ?&gt;
+                &lt;textarea class=&quot;code&quot; readonly=&quot;readonly&quot; cols=&quot;100&quot; rows=&quot;&lt;?php echo substr_count( $htaccess_file, &quot;\n&quot; ) + 1; ?&gt;&quot;&gt;
</ins><span class="cx"> &lt;?php echo esc_textarea( $htaccess_file ); ?&gt;&lt;/textarea&gt;&lt;/li&gt;
</span><span class="cx">                 &lt;/ol&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludesfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/functions.php (21822 => 21823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/functions.php        2012-09-11 22:06:49 UTC (rev 21822)
+++ trunk/wp-includes/functions.php        2012-09-11 22:22:20 UTC (rev 21823)
</span><span class="lines">@@ -1432,21 +1432,16 @@
</span><span class="cx">  * @return array See above for description.
</span><span class="cx">  */
</span><span class="cx"> function wp_upload_dir( $time = null ) {
</span><del>-        global $_wp_switched;
</del><span class="cx">         $siteurl = get_option( 'siteurl' );
</span><del>-        $upload_path = get_option( 'upload_path' );
-        $upload_path = trim($upload_path);
-        $main_override = is_multisite() &amp;&amp; defined( 'MULTISITE' ) &amp;&amp; is_main_site();
-        if ( empty($upload_path) ) {
</del><ins>+        $upload_path = trim( get_option( 'upload_path' ) );
+
+        if ( empty( $upload_path ) || 'wp-content/uploads' == $upload_path ) {
</ins><span class="cx">                 $dir = WP_CONTENT_DIR . '/uploads';
</span><ins>+        } elseif ( 0 !== strpos( $upload_path, ABSPATH ) ) {
+                // $dir is absolute, $upload_path is (maybe) relative to ABSPATH
+                $dir = path_join( ABSPATH, $upload_path );
</ins><span class="cx">         } else {
</span><span class="cx">                 $dir = $upload_path;
</span><del>-                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 );
-                }
</del><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if ( !$url = get_option( 'upload_url_path' ) ) {
</span><span class="lines">@@ -1456,15 +1451,24 @@
</span><span class="cx">                         $url = trailingslashit( $siteurl ) . $upload_path;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if ( defined('UPLOADS') &amp;&amp; ! $main_override &amp;&amp; ! $_wp_switched ) {
</del><ins>+        if ( defined( 'UPLOADS' ) ) {
</ins><span class="cx">                 $dir = ABSPATH . UPLOADS;
</span><span class="cx">                 $url = trailingslashit( $siteurl ) . UPLOADS;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if ( is_multisite() &amp;&amp; ! $main_override &amp;&amp; ! $_wp_switched  ) {
-                if ( defined( 'BLOGUPLOADDIR' ) )
-                        $dir = untrailingslashit(BLOGUPLOADDIR);
-                $url = str_replace( UPLOADS, 'files', $url );
</del><ins>+        // Multisite (if not the main site in a post-MU network)
+        if ( is_multisite() &amp;&amp; ! ( is_main_site() &amp;&amp; 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 );
+                }
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         $basedir = $dir;
</span></span></pre></div>
<a id="trunkwpincludesmsdefaultconstantsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/ms-default-constants.php (21822 => 21823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-default-constants.php        2012-09-11 22:06:49 UTC (rev 21822)
+++ trunk/wp-includes/ms-default-constants.php        2012-09-11 22:22:20 UTC (rev 21823)
</span><span class="lines">@@ -10,11 +10,17 @@
</span><span class="cx"> /**
</span><span class="cx">  * Defines Multisite upload constants.
</span><span class="cx">  *
</span><ins>+ * Exists for backward compatibility with legacy file-serving through
+ * wp-includes/ms-files.php (wp-content/blogs.php in MU).
+ *
</ins><span class="cx">  * @since 3.0.0
</span><span class="cx">  */
</span><del>-function ms_upload_constants(  ) {
</del><ins>+function ms_upload_constants() {
</ins><span class="cx">         global $wpdb;
</span><span class="cx"> 
</span><ins>+        if ( ! get_site_option( 'ms_files_rewriting' ) )
+                return;
+
</ins><span class="cx">         /** @since 3.0.0 */
</span><span class="cx">         // Base uploads dir relative to ABSPATH
</span><span class="cx">         if ( !defined( 'UPLOADBLOGSDIR' ) )
</span><span class="lines">@@ -24,7 +30,7 @@
</span><span class="cx">         if ( !defined( 'UPLOADS' ) ) {
</span><span class="cx">                 // Uploads dir relative to ABSPATH
</span><span class="cx">                 define( 'UPLOADS', UPLOADBLOGSDIR . &quot;/{$wpdb-&gt;blogid}/files/&quot; );
</span><del>-                if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR )
</del><ins>+                if ( 'wp-content/blogs.dir' == UPLOADBLOGSDIR &amp;&amp; ! defined( 'BLOGUPLOADDIR' ) )
</ins><span class="cx">                         define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . &quot;/blogs.dir/{$wpdb-&gt;blogid}/files/&quot; );
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="lines">@@ -74,9 +80,12 @@
</span><span class="cx"> /**
</span><span class="cx">  * Defines Multisite file constants.
</span><span class="cx">  *
</span><ins>+ * Exists for backward compatibility with legacy file-serving through
+ * wp-includes/ms-files.php (wp-content/blogs.php in MU).
+ *
</ins><span class="cx">  * @since 3.0.0
</span><span class="cx">  */
</span><del>-function ms_file_constants(  ) {
</del><ins>+function ms_file_constants() {
</ins><span class="cx">         /**
</span><span class="cx">          * Optional support for X-Sendfile header
</span><span class="cx">          * @since 3.0.0
</span></span></pre></div>
<a id="trunkwpincludesmsdefaultfiltersphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/ms-default-filters.php (21822 => 21823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-default-filters.php        2012-09-11 22:06:49 UTC (rev 21822)
+++ trunk/wp-includes/ms-default-filters.php        2012-09-11 22:22:20 UTC (rev 21823)
</span><span class="lines">@@ -61,3 +61,6 @@
</span><span class="cx"> // WP_HOME and WP_SITEURL should not have any effect in MS
</span><span class="cx"> remove_filter( 'option_siteurl', '_config_wp_siteurl' );
</span><span class="cx"> remove_filter( 'option_home',    '_config_wp_home'    );
</span><ins>+
+// 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' );
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesmsfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/ms-functions.php (21822 => 21823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-functions.php        2012-09-11 22:06:49 UTC (rev 21822)
+++ trunk/wp-includes/ms-functions.php        2012-09-11 22:22:20 UTC (rev 21823)
</span><span class="lines">@@ -1120,8 +1120,7 @@
</span><span class="cx">  * @param string $blog_title The title of the new site.
</span><span class="cx">  */
</span><span class="cx"> function install_blog($blog_id, $blog_title = '') {
</span><del>-        global $wpdb, $table_prefix, $wp_roles;
-        $wpdb-&gt;suppress_errors();
</del><ins>+        global $wpdb, $wp_roles, $current_site;
</ins><span class="cx"> 
</span><span class="cx">         // Cast for security
</span><span class="cx">         $blog_id = (int) $blog_id;
</span><span class="lines">@@ -1129,12 +1128,10 @@
</span><span class="cx">         require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
</span><span class="cx"> 
</span><span class="cx">         if ( $wpdb-&gt;get_results(&quot;SELECT ID FROM $wpdb-&gt;posts&quot;) )
</span><del>-                die(__('&lt;h1&gt;Already Installed&lt;/h1&gt;&lt;p&gt;You appear to have already installed WordPress. To reinstall please clear your old database tables first.&lt;/p&gt;') . '&lt;/body&gt;&lt;/html&gt;');
</del><ins>+                die( __( '&lt;h1&gt;Already Installed&lt;/h1&gt;&lt;p&gt;You appear to have already installed WordPress. To reinstall please clear your old database tables first.&lt;/p&gt;' ) . '&lt;/body&gt;&lt;/html&gt;' );
</ins><span class="cx"> 
</span><del>-        $wpdb-&gt;suppress_errors(false);
</del><ins>+        $url = get_blogaddress_by_id( $blog_id );
</ins><span class="cx"> 
</span><del>-        $url = get_blogaddress_by_id($blog_id);
-
</del><span class="cx">         // Set everything up
</span><span class="cx">         make_db_current_silent( 'blog' );
</span><span class="cx">         populate_options();
</span><span class="lines">@@ -1142,21 +1139,22 @@
</span><span class="cx">         $wp_roles-&gt;_init();
</span><span class="cx"> 
</span><span class="cx">         $url = untrailingslashit( $url );
</span><del>-        // fix url.
-        update_option('siteurl', $url);
-        update_option('home', $url);
-        update_option('fileupload_url', $url . &quot;/files&quot; );
-        update_option('upload_path', UPLOADBLOGSDIR . &quot;/$blog_id/files&quot;);
-        update_option('blogname', stripslashes( $blog_title ) );
-        update_option('admin_email', '');
-        $wpdb-&gt;update( $wpdb-&gt;options, array('option_value' =&gt; ''), array('option_name' =&gt; 'admin_email') );
</del><span class="cx"> 
</span><del>-        // remove all perms
-        $wpdb-&gt;delete( $wpdb-&gt;usermeta, array( 'meta_key' =&gt; $table_prefix.'user_level' ) );
</del><ins>+        update_option( 'siteurl', $url );
+        update_option( 'home', $url );
</ins><span class="cx"> 
</span><del>-        $wpdb-&gt;delete( $wpdb-&gt;usermeta, array( 'meta_key' =&gt; $table_prefix.'capabilities' ) );
</del><ins>+        if ( get_site_option( 'ms_files_rewriting' ) )
+                update_option( 'upload_path', UPLOADBLOGSDIR . &quot;/$blog_id/files&quot; );
+        else
+                update_option( 'upload_path', get_blog_option( $current_site-&gt;blog_id, 'upload_path' ) );
</ins><span class="cx"> 
</span><del>-        $wpdb-&gt;suppress_errors( false );
</del><ins>+        update_option( 'blogname', stripslashes( $blog_title ) );
+        update_option( 'admin_email', '' );
+
+        // remove all perms
+        $table_prefix = $wpdb-&gt;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
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span></span></pre></div>
<a id="trunkwpincludesoptionphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/option.php (21822 => 21823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/option.php        2012-09-11 22:06:49 UTC (rev 21822)
+++ trunk/wp-includes/option.php        2012-09-11 22:22:20 UTC (rev 21823)
</span><span class="lines">@@ -174,7 +174,7 @@
</span><span class="cx">         if ( empty($site_id) )
</span><span class="cx">                 $site_id = $wpdb-&gt;siteid;
</span><span class="cx"> 
</span><del>-        $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' );
</del><ins>+        $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' );
</ins><span class="cx"> 
</span><span class="cx">         $core_options_in = &quot;'&quot; . implode(&quot;', '&quot;, $core_options) . &quot;'&quot;;
</span><span class="cx">         $options = $wpdb-&gt;get_results( $wpdb-&gt;prepare(&quot;SELECT meta_key, meta_value FROM $wpdb-&gt;sitemeta WHERE meta_key IN ($core_options_in) AND site_id = %d&quot;, $site_id) );
</span></span></pre></div>
<a id="trunkwpincludesrewritephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/rewrite.php (21822 => 21823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/rewrite.php        2012-09-11 22:06:49 UTC (rev 21822)
+++ trunk/wp-includes/rewrite.php        2012-09-11 22:22:20 UTC (rev 21823)
</span><span class="lines">@@ -1742,15 +1742,19 @@
</span><span class="cx">                 } else {
</span><span class="cx">                         if (is_subdomain_install()) {
</span><span class="cx">                                 $rules .= '
</span><del>-                                &lt;rule name=&quot;wordpress - Rule 1&quot; stopProcessing=&quot;true&quot;&gt;
</del><ins>+                                &lt;rule name=&quot;WordPress Rule 1&quot; stopProcessing=&quot;true&quot;&gt;
</ins><span class="cx">                                         &lt;match url=&quot;^index\.php$&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="cx">                                         &lt;action type=&quot;None&quot; /&gt;
</span><del>-                                &lt;/rule&gt;
-                                &lt;rule name=&quot;wordpress - Rule 2&quot; stopProcessing=&quot;true&quot;&gt;
</del><ins>+                                &lt;/rule&gt;';
+                                if ( get_site_option( 'ms_files_rewriting' ) ) {
+                                        $rules .= '
+                                &lt;rule name=&quot;WordPress Rule for Files&quot; stopProcessing=&quot;true&quot;&gt;
</ins><span class="cx">                                         &lt;match url=&quot;^files/(.+)&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="cx">                                         &lt;action type=&quot;Rewrite&quot; url=&quot;wp-includes/ms-files.php?file={R:1}&quot; appendQueryString=&quot;false&quot; /&gt;
</span><del>-                                &lt;/rule&gt;
-                                &lt;rule name=&quot;wordpress - Rule 3&quot; stopProcessing=&quot;true&quot;&gt;
</del><ins>+                                &lt;/rule&gt;';
+                                }
+                                $rules .= '
+                                &lt;rule name=&quot;WordPress Rule 2&quot; stopProcessing=&quot;true&quot;&gt;
</ins><span class="cx">                                         &lt;match url=&quot;^&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="cx">                                         &lt;conditions logicalGrouping=&quot;MatchAny&quot;&gt;
</span><span class="cx">                                                 &lt;add input=&quot;{REQUEST_FILENAME}&quot; matchType=&quot;IsFile&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="lines">@@ -1758,25 +1762,29 @@
</span><span class="cx">                                         &lt;/conditions&gt;
</span><span class="cx">                                         &lt;action type=&quot;None&quot; /&gt;
</span><span class="cx">                                 &lt;/rule&gt;
</span><del>-                                &lt;rule name=&quot;wordpress - Rule 4&quot; stopProcessing=&quot;true&quot;&gt;
</del><ins>+                                &lt;rule name=&quot;WordPress Rule 3&quot; stopProcessing=&quot;true&quot;&gt;
</ins><span class="cx">                                         &lt;match url=&quot;.&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="cx">                                         &lt;action type=&quot;Rewrite&quot; url=&quot;index.php&quot; /&gt;
</span><span class="cx">                                 &lt;/rule&gt;';
</span><span class="cx">                         } else {
</span><span class="cx">                                 $rules .= '
</span><del>-                                &lt;rule name=&quot;wordpress - Rule 1&quot; stopProcessing=&quot;true&quot;&gt;
</del><ins>+                                &lt;rule name=&quot;WordPress Rule 1&quot; stopProcessing=&quot;true&quot;&gt;
</ins><span class="cx">                                         &lt;match url=&quot;^index\.php$&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="cx">                                         &lt;action type=&quot;None&quot; /&gt;
</span><del>-                                &lt;/rule&gt;
-                                &lt;rule name=&quot;wordpress - Rule 2&quot; stopProcessing=&quot;true&quot;&gt;
</del><ins>+                                &lt;/rule&gt;';
+                                if ( get_site_option( 'ms_files_rewriting' ) ) {
+                                        $rules .= '
+                                &lt;rule name=&quot;WordPress Rule for Files&quot; stopProcessing=&quot;true&quot;&gt;
</ins><span class="cx">                                         &lt;match url=&quot;^([_0-9a-zA-Z-]+/)?files/(.+)&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="cx">                                         &lt;action type=&quot;Rewrite&quot; url=&quot;wp-includes/ms-files.php?file={R:2}&quot; appendQueryString=&quot;false&quot; /&gt;
</span><del>-                                &lt;/rule&gt;
-                                &lt;rule name=&quot;wordpress - Rule 3&quot; stopProcessing=&quot;true&quot;&gt;
</del><ins>+                                &lt;/rule&gt;';
+                                }
+                                $rules .= '
+                                &lt;rule name=&quot;WordPress Rule 2&quot; stopProcessing=&quot;true&quot;&gt;
</ins><span class="cx">                                         &lt;match url=&quot;^([_0-9a-zA-Z-]+/)?wp-admin$&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="cx">                                         &lt;action type=&quot;Redirect&quot; url=&quot;{R:1}wp-admin/&quot; redirectType=&quot;Permanent&quot; /&gt;
</span><span class="cx">                                 &lt;/rule&gt;
</span><del>-                                &lt;rule name=&quot;wordpress - Rule 4&quot; stopProcessing=&quot;true&quot;&gt;
</del><ins>+                                &lt;rule name=&quot;WordPress Rule 3&quot; stopProcessing=&quot;true&quot;&gt;
</ins><span class="cx">                                         &lt;match url=&quot;^&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="cx">                                         &lt;conditions logicalGrouping=&quot;MatchAny&quot;&gt;
</span><span class="cx">                                                 &lt;add input=&quot;{REQUEST_FILENAME}&quot; matchType=&quot;IsFile&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="lines">@@ -1784,15 +1792,15 @@
</span><span class="cx">                                         &lt;/conditions&gt;
</span><span class="cx">                                         &lt;action type=&quot;None&quot; /&gt;
</span><span class="cx">                                 &lt;/rule&gt;
</span><del>-                                &lt;rule name=&quot;wordpress - Rule 5&quot; stopProcessing=&quot;true&quot;&gt;
</del><ins>+                                &lt;rule name=&quot;WordPress Rule 4&quot; stopProcessing=&quot;true&quot;&gt;
</ins><span class="cx">                                         &lt;match url=&quot;^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="cx">                                         &lt;action type=&quot;Rewrite&quot; url=&quot;{R:1}&quot; /&gt;
</span><span class="cx">                                 &lt;/rule&gt;
</span><del>-                                &lt;rule name=&quot;wordpress - Rule 6&quot; stopProcessing=&quot;true&quot;&gt;
</del><ins>+                                &lt;rule name=&quot;WordPress Rule 5&quot; stopProcessing=&quot;true&quot;&gt;
</ins><span class="cx">                                         &lt;match url=&quot;^([_0-9a-zA-Z-]+/)?(.*\.php)$&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="cx">                                         &lt;action type=&quot;Rewrite&quot; url=&quot;{R:2}&quot; /&gt;
</span><span class="cx">                                 &lt;/rule&gt;
</span><del>-                                &lt;rule name=&quot;wordpress - Rule 7&quot; stopProcessing=&quot;true&quot;&gt;
</del><ins>+                                &lt;rule name=&quot;WordPress Rule 6&quot; stopProcessing=&quot;true&quot;&gt;
</ins><span class="cx">                                         &lt;match url=&quot;.&quot; ignoreCase=&quot;false&quot; /&gt;
</span><span class="cx">                                         &lt;action type=&quot;Rewrite&quot; url=&quot;index.php&quot; /&gt;
</span><span class="cx">                                 &lt;/rule&gt;';
</span></span></pre></div>
<a id="trunkwpincludesversionphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/version.php (21822 => 21823)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/version.php        2012-09-11 22:06:49 UTC (rev 21822)
+++ trunk/wp-includes/version.php        2012-09-11 22:22:20 UTC (rev 21823)
</span><span class="lines">@@ -11,7 +11,7 @@
</span><span class="cx">  *
</span><span class="cx">  * @global int $wp_db_version
</span><span class="cx">  */
</span><del>-$wp_db_version = 21818;
</del><ins>+$wp_db_version = 21823;
</ins><span class="cx"> 
</span><span class="cx"> /**
</span><span class="cx">  * Holds the TinyMCE version
</span></span></pre>
</div>
</div>

</body>
</html>