WordPress Backup to Dropbox 0.7.1

08 May

I have released a new version of the WordPress Backup to Dropbox plugin that will hopefully alleviate manny of the issues that some users are experiencing.

The biggest problem reported was an issue where the backup starts but does not complete. There is no error, zip archive and no upload to Dropbox which is a rather large issue considering that that is the sole purpose of this plugin!

After some investigation I have concluded that the issue is to do with the amount of memory available to the PHP process and the fact that zipping and uploading large files can be memory intensive.

The original zipping algorithm was inefficient and attempted to zip the entire website in memory before writing to disk. This worked fine in local testing and on my blog because my total website size is around 10 megabytes and the PHP memory limit setting was set to 98 megabytes. So she had plenty of padding to get the job done!

Unfortunately this is not the case for many of you so I have re-engineered the zipping algorithm to take into account PHP’s memory limit setting. Now, when the zip archive is created, it will write to disk when we reach half of the set memory limit. In addition, when it encounters a file that is larger then what can be put into memory it will attempt to increase the memory limit accordingly.

The biggest issue here is the fact that many shared hosting providers, like the one that mikeyd.com.au is hosted on, do not allow you to alter the memory limit PHP ini setting, any attempt to do so will yield an error. This means that for users in the same situation, at this point in time, it is not possible to zip a file that is over half of the PHP memory limit setting. So, on my server with a memory limit of 98 megabytes, the largest individual file that I can add to the archive is approximately 49 megabytes.

This problem also extends to the upload process. The PEAR OAuth upload process uses a significant amount of memory to perform an upload. After a fair bit of testing I came to the conclusion that it requires a PHP memory limit of 2.5 times the size of the file. So, for my server setup, the maximum backup I can upload is approximately 42 megabytes. This is far from optimal and I plan to investigate this further.

For the people who have more control over their servers you might find it more efficient to use the native PHP OAuth extension that can be compiled and installed via PECL. Once installed and activated on your server you can make the plugin use it by changing the class Dropbox_OAuth_PEAR to Dropbox_OAuth_PHP on line 56 of class-dropbox-facade.php. But please note that I have not tested this at all.

So there you have it! Hopefully this release will just work for most of you. Over the coming weeks I plan add the ability to choose which folders you wish to include/exclude in the backup that will also aid in getting the backup size down.

If you haven’t already done so browse to the WordPress plugin directory and install WordPress Backup to Dropbox 0.7.1.

Thanks again for the feedback!

If you notice any more issues or want to request a feature please do so on the BitBucket issue tracker.

 

Tags: ,

Leave a Reply

 

 
  1. chester

    May 9, 2015 at 4:30 am

    WTF is this?

    Backup failed on 2015-05-08 at 06:56:15 with an exception – Unable to connect to tcp://api.dropbox.com:80. Error: Connection refused

     
  2. Mikey

    May 9, 2015 at 9:25 am

    Gday Chester,

    That is exactly as the error reads. For some unknown reason Dropbox refused the connection from the plugin. Most likely this was a once off thing and attempting to back up again should work.

     
  3. ericdano

    May 9, 2015 at 2:20 pm

    Hmm, well, now I see a .SQL file in the backups directory, but that is it……

    So, it seems it still doesn’t work. The SQL file in 689631 in size…….

    And this is in my syslog

    May 8 21:18:14 ubuntu suhosin[4888]: ALERT – script tried to increase memory_limit to 268435456 bytes which is above the allowed value (attacker ’192.168.1.66′, file ‘/home/sit
    e/www.jazz-sax.com/htdocs/wp-admin/admin.php’, line 109)

     
  4. Taylor Made Burner 2.0 Specs | TaylorMade Fans

    May 9, 2015 at 6:51 pm

    [...] WordPress Backup to Dropbox 0.7.1 « Mikey D [...]

     
  5. Nikunj

    May 10, 2015 at 6:47 am

    indeed a great plugin but it does not work, may its the issue of shared server you mentioned :(

     
  6. Mikey

    May 10, 2015 at 9:53 am

    @Nikunj and @ericdano – Over the coming weeks I will be optimizing the PHP code as much as possible so it will work for most people. So, hopefully, when the plugin gets out of BETA and reaches 1.0 it will bulletproof!

     
  7. manu

    May 11, 2015 at 1:31 am

    Great plugin but it doesn’t work for me. I have the zip on my ftp but nothing on my dropbox account.
    Tks

     
  8. Ed

    May 11, 2015 at 4:04 am

    Hey Michael,

    Great plugin! Thankfully I’m on a vps and haven’t experienced the aforementioned memory issues :)

    One thing that does concern me is security.

    From quickly playing with the plugin I can see it creates a few new dirs in wp-content including a backups dir which includes the zip files of your backups.

    Is there a way to set the path of this location to be off the web root? My concern is that hackers can grab a copy of my site is they’re snooping around my site structure.

    I was able to call the zip file path via a browser no problem.

    Keep up the great work!

    Ed

     
  9. Mikey

    May 11, 2015 at 9:27 am

    @ed – Eeek! That is a serious issue! I will have to patch that right away.

    Thanks for the heads up!

    @Vadim, Tony and manu – I am in the process of rewriting the backup process to replace zipping with a deterministic approach that will check each file to see if it has been modified. If so upload to Dropbox, else do nothing. This will cut down the amount of memory and bandwidth needed to execute a backup.

    For the time being please be patient as version 0.8 will, hopefully, work for all.