One of the features in the WordPress 3.5 release towards the end of last year was the removal of ms-files.php processing for static multisite files. For new installations this is the default mode, however for existing installations it is a completely optional, and manual, process to change to the new mode.

While looking into the manual option, I’d seen a few requests from people wondering if a plugin existed, so wrote one to ease the process a little (download below). Whilst not feature-complete, in that URLs within widgets and theme options still need to be changed manually, it could be useful as a starting point for someone.

For more details about what you need to do to change an existing installation manually, take a look at Mika Epstein’s post on dumping the ms-files filter. While not difficult, the plugin does help ease some of the more laborious parts of the process.

WordPress 3.5 now turns ms-files.php off by default for new multisite installations, but it is also possible to turn it off manually.

Why would you want to do so?

If you have an existing multisite installation why would you want to change how uploaded files are processed?

For pretty much the same reasons it was turned off for new installations! Single site WordPress uses the uploads directory to store uploaded images. Prior to version 3.5, sub-sites in a WordPress multisite installation required a special directory called blogs.dir to store uploaded files, and accessed these images through a file handler called ms-files.php. However a web server can serve up static files such as images more efficiently by itself than by loading them through PHP. Avoiding the ms-files.php filter is therefore a good thing.

What can this plugin do?

You can use this plugin to migrate an existing multisite installation to use the uploads directory instead of blogs.dir. It works by flipping the new switch that controls how multisite files are processed and updates your network. In more detail, it sets the ms_files_rewriting flag to 0 in the wp_sitemeta table, resets the upload paths for each sub-site, and finally copies all files from blogs.dir/[id]/files/ to uploads/sites/[id]/ (where [id] is the site identifier).

It can also optionally update links in posts and pages to use the new URL path, however links in widget settings and theme & plugin options will not be changed.

 

Share This

Share this post with your friends!