Title: Separated multisite backups
Last modified: August 20, 2016

---

# Separated multisite backups

 *  [narcisgarcia](https://wordpress.org/support/users/narcisgarcia/)
 * (@narcisgarcia)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/separated-multisite-backups/)
 * Does anybody know a solution to make a backup only for a single blog in a multisite
   installation?
 * I have a subdirectories-based network installation, and wish to give a way for
   each blog administrator to make a backup (DB & files) only for its own blog.

Viewing 15 replies - 1 through 15 (of 35 total)

1 [2](https://wordpress.org/support/topic/separated-multisite-backups/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/separated-multisite-backups/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/separated-multisite-backups/page/2/?output_format=md)

 *  [Andrea Rennick](https://wordpress.org/support/users/andrea_r/)
 * (@andrea_r)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/separated-multisite-backups/#post-2139338)
 * Tools -Export.
 * That’s it.
 *  Thread Starter [narcisgarcia](https://wordpress.org/support/users/narcisgarcia/)
 * (@narcisgarcia)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/separated-multisite-backups/#post-2139465)
 * Thanks, very useful.
    But I don’t find an export way for site preferences and
   files.
 *  [Andrea Rennick](https://wordpress.org/support/users/andrea_r/)
 * (@andrea_r)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/separated-multisite-backups/#post-2139466)
 * ou won’t. currently there’s nothing out there to export a single site off a network.
   it’s everything or the export file.
 * you don’t want to give blog users access to the entire db.
 *  Thread Starter [narcisgarcia](https://wordpress.org/support/users/narcisgarcia/)
 * (@narcisgarcia)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/separated-multisite-backups/#post-2139500)
 * Sure, I don’t want to give blog users access to the entire network data; only
   to their own data to make it restorable on another WordPress installation.
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [14 years, 11 months ago](https://wordpress.org/support/topic/separated-multisite-backups/#post-2139508)
 * The menus and prefs are not the data. The data is your post content and the images.
   THOSE are exportable.
 *  Thread Starter [narcisgarcia](https://wordpress.org/support/users/narcisgarcia/)
 * (@narcisgarcia)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/separated-multisite-backups/#post-2139515)
 * I understand as user’s data:
    – Published texts (Posts, Pages, Comments) – Attached
   files (media) – Site preferences (menus, selected theme, title, etc.) – Plugin
   preferences and their custom accessory files
 * Conclusion: all information and files that single-site administrator could set,
   write and upload.
 *  [Andrea Rennick](https://wordpress.org/support/users/andrea_r/)
 * (@andrea_r)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/separated-multisite-backups/#post-2139524)
 * > – Site preferences (menus, selected theme, title, etc.)
   >  – Plugin preferences
   > and their custom accessory files
 * these are not included in the Export tool.
 * As I said above – **there is no plugin** that does exactly what you want.
 *  Thread Starter [narcisgarcia](https://wordpress.org/support/users/narcisgarcia/)
 * (@narcisgarcia)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/separated-multisite-backups/#post-2139527)
 * Then, is there any way to export easily attached files for published contents?
 *  [mdevaney](https://wordpress.org/support/users/mdevaney/)
 * (@mdevaney)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/separated-multisite-backups/#post-2139528)
 * > As I said above – there is no plugin that does exactly what you want.
 *  I think thats true in all cases lmao.
 * [@narcisgarcia](https://wordpress.org/support/users/narcisgarcia/) for each user
   or just for yourself?
 *  [mdevaney](https://wordpress.org/support/users/mdevaney/)
 * (@mdevaney)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/separated-multisite-backups/#post-2139529)
 * You could make backups of each by using zipping method.
 *     ```
       class createDirZip extends createZip {
   
       	function get_files_from_folder($directory, $put_into) {
       		if ($handle = opendir($directory)) {
       			while (false !== ($file = readdir($handle))) {
       				if (is_file($directory.$file)) {
       					$fileContents = file_get_contents($directory.$file);
       					$this->addFile($fileContents, $put_into.$file);
       				} elseif ($file != '.' and $file != '..' and is_dir($directory.$file)) {
       					$this->addDirectory($put_into.$file.'/');
       					$this->get_files_from_folder($directory.$file.'/', $put_into.$file.'/');
       				}
       			}
       		}
       		closedir($handle);
       	}
       }
       ```
   
 * then
 *     ```
       $createZip = new createDirZip;
       $createZip->addDirectory('uploads/');
       $createZip->get_files_from_folder('/wp-content/uploads/', 'uploads/');
       ```
   
 * and
 *     ```
       $fileName = 'tmp/uploadsbackup.zip';
       $fd = fopen ($fileName, 'wb');
       $out = fwrite ($fd, $createZip->getZippedfile());
       fclose ($fd);
   
       $createZip->forceDownload($fileName);
       @unlink($fileName);
       ```
   
 * this will take all of the contents of /uploads/ and zip it into “uploadsbackup.
   zip”
 * it might be a pain in the butt to do this for each user but im sure you can alter
   the code above to do so, find users, and place the username within the `get_files_from_folder('".
   $users."/uploads/` or whatever.
 *  [mdevaney](https://wordpress.org/support/users/mdevaney/)
 * (@mdevaney)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/separated-multisite-backups/#post-2139530)
 * you could use something like this to grab the usernames in order from newest 
   to oldest and if you place it in a `<li>` you could have a nice list of all the
   backups you need to download right away.
 *     ```
       $usernames = $wpdb->get_results("SELECT user_nicename, user_url FROM $wpdb->users ORDER BY ID DESC LIMIT 999");
       foreach ($usernames as $username) {
       ```
   
 *     ```
       $createZip->get_files_from_folder('/".$username->user_nicename."/uploads/', 'uploads/');
       ```
   
 * also adding the username to the temp. zip
 *     ```
       $fileName = 'tmp/".$username->user_nicename."backup.zip';
       ```
   
 *  [mdevaney](https://wordpress.org/support/users/mdevaney/)
 * (@mdevaney)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/separated-multisite-backups/#post-2139531)
 * just depends on how bad you need those backups, and or separated.
 *  Thread Starter [narcisgarcia](https://wordpress.org/support/users/narcisgarcia/)
 * (@narcisgarcia)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/separated-multisite-backups/#post-2139532)
 * I manage a multisite installation (subdirectory based), and need to give a way
   for each user (1 user owns 1 sub-site, another user owns another sub-site) to
   backup own contents.
 * Of course I can backup the entire multisite directory and database, but cannot
   deliver this backup to “user 1” when also contains data from user 2, 3, 4, etc.
 * I see that the multisite uploaded files are in /wp-content/blogs.dir/ and I don’t
   see clear separation between each site correspondence.
 *  [mdevaney](https://wordpress.org/support/users/mdevaney/)
 * (@mdevaney)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/separated-multisite-backups/#post-2139533)
 * my multi site works as [http://domain.com/username/wp-content/uploads/](http://domain.com/username/wp-content/uploads/)
 * you can alter the code above to be specific and add the needed directory for 
   lets say the “uploads” and you could make a generic file for each logged in user
 * and you could grab the the URL of each user by doing this:
 *     ```
       $usernames = $wpdb->get_results("SELECT user_nicename, user_url FROM $wpdb->users ORDER BY ID DESC LIMIT 999");
       foreach ($usernames as $username) {
       echo '<li>http://www.yourdomain.com/'.$username->user_nicename.'/wp-content/uploads</li>";
       ```
   
 * it will pump out from new to old:
 * [http://www.yourdomain.com/username10/wp-content/uploads/](http://www.yourdomain.com/username10/wp-content/uploads/)
   
   [http://www.yourdomain.com/username9/wp-content/uploads/](http://www.yourdomain.com/username9/wp-content/uploads/)
   [http://www.yourdomain.com/username8/wp-content/uploads/](http://www.yourdomain.com/username8/wp-content/uploads/)
   [http://www.yourdomain.com/username7/wp-content/uploads/](http://www.yourdomain.com/username7/wp-content/uploads/)
 * but it will replace the username## with like the username or site name i personally
   use usernames as the subdir.
 *  [mdevaney](https://wordpress.org/support/users/mdevaney/)
 * (@mdevaney)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/separated-multisite-backups/#post-2139534)
 * eh, after all this i should just make a plugin that would backup mutli-site users
   profile, uploads, posts, pages, links, and so on. :X

Viewing 15 replies - 1 through 15 (of 35 total)

1 [2](https://wordpress.org/support/topic/separated-multisite-backups/page/2/?output_format=md)
[3](https://wordpress.org/support/topic/separated-multisite-backups/page/3/?output_format=md)
[→](https://wordpress.org/support/topic/separated-multisite-backups/page/2/?output_format=md)

The topic ‘Separated multisite backups’ is closed to new replies.

 * In: [Networking WordPress](https://wordpress.org/support/forum/multisite/)
 * 35 replies
 * 5 participants
 * Last reply from: [Andrea Rennick](https://wordpress.org/support/users/andrea_r/)
 * Last activity: [14 years, 11 months ago](https://wordpress.org/support/topic/separated-multisite-backups/page/3/#post-2139599)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
