I am restoring a pre-WordPress-3.5 multisite into a 3.5-or-later multisite – what happened to my blogs.dir?

Before WordPress 3.5, a new WordPress Network (i.e. Multisite) install used to keep media uploads (images, etc.) in the uploads directory (for the “main” site on the network, site ID 1), and in a separate directory (called blogs.dir by default) for other sites. By default, blogs.dir was found at wp-content/blogs.dir, and UpdraftPlus’s multisite add-on would back it up separately.

From WordPress 3.5 onwards, a newly set up (i.e. not upgraded) multisite would instead put all blogs’ uploads in the uploads directory (wp-content/uploads, by default). This is more consistent, and leads to fewer backup zips.

However, this presents a small issue if you have a backup from a pre-3.5-era multisite, and wish to restore it into a 3.5-or-later multisite. You have a backup of blogs.dir – but your new site has no such location.

This issue does not arise if you have only upgraded your pre-3.5-era multisite to 3.5 or later – in that case, WordPress will run it in a compatibility mode, and keep the blogs.dir setup). Furthermore, this issue is not relevant if you are restoring a database from a pre-3.5.-era multisite, because doing this will trigger WordPress’s compatibility handling.

What to do? You can do this:

  • Unzip your blogs.dir backup zip (i.e. the one that UpdraftPlus created). It will contain subdirectories for each site on the network, like blogs.dir/2, blogs.dir/3, etc.
  • Also unzip your uploads backup zip. This will contain a subdirectory, “uploads”.
  • Create a subdirectory “sites” inside it the “uploads” subdirectory (i.e. “uploads/sites”).
  • Move the contents of the blogs.dir directory into uploads/sites (so now you will have “uploads/sites/1”, “uploads/sites/2”, etc.).
  • Zip up the uploads directory again, so that you have a zip file with one subdirectory in the top level (“uploads”).
  • You can then use the new uploads zip to import your site uploads.

Alternatively, just perform the restoration, and then copy over the contents manually from your blogs.dir backup zip into wp-content/uploads/sites on your new site.

You can do the same procedure  in reverse if wanting to transfer content from a post-3.5-era setup into a pre-3.5 multisite.

Posted in: Multisite, Restoration