[wp-trac] [WordPress Trac] #19235: Turn ms-files.php off by default

WordPress Trac wp-trac at lists.automattic.com
Wed Aug 8 05:57:19 UTC 2012


#19235: Turn ms-files.php off by default
----------------------------+------------------
 Reporter:  nacin           |       Owner:
     Type:  task (blessed)  |      Status:  new
 Priority:  normal          |   Milestone:  3.5
Component:  Multisite       |     Version:  3.0
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |
----------------------------+------------------
Changes (by nacin):

 * keywords:  needs-patch => has-patch


Comment:

 [attachment:19235.3.diff] — fully backwards compatible. Handles the
 upgrade seamlessly. Works great in my testing.

  * The URL becomes wp-content/uploads/sites/%d. Not the cleanest, but
 definitely the best option.

  * ms_files_rewriting becomes a network-wide option set in
 upgrade_network() and populate_network(). Defaults to 0 for new installs,
 1 for existing networks, and new networks on an existing install inherit.
 If upgrade_network() hasn't run yet, all existing networks will get
 screwed up, so I use a filter to enforce, globally, the default of
 get_site_option( 'ms_files_rewriting' ) to be true until something is
 inserted into the DB.

  * All logic ends up in wp_upload_dir(). 'UPLOADS' is again a fully
 functional constant, regardless of is_main_site() or $switched. ($switched
 is simply there to ensure the old MS constants aren't lying, given that
 they hard-code a blog ID.)

  * upload_path for new sites (on a non-rewriting network) is whatever the
 main site's upload_path is, which is going to be empty. Note that
 "sites/%d" is always appended to upload_path (which in this case would
 translate to "wp-content/uploads"). Some direct DB queries in
 install_blog() are cleaned up as well.

  * wp_upload_dir() is changed to always return the data you wanted, even
 if it returns an error due to directory creation failing. Huzzah!
 _wp_relative_upload_path() is changed to always trim off the basedir, even
 when there is an error, as an enhancement.

  * Warnings for custom content directories are now only issued for
 subdirectory networks (thanks to the wp-(content|admin|includes) rewrite).
 Subdomain networks are now in the clear.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19235#comment:49>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list