WordPress Backup to Dropbox 0.8

26 May

After many late nights I am pleased to finally release WordPress Backup to Dropbox 0.8!

In this release I have significantly changed the way backups are performed in order to make the process more efficient, smarter and use less memory and bandwidth. The biggest problems that people have been reporting is the plugin “Does not work” or “Starts but no backup is appearing in Dropbox”. Firstly, let me assure you, that I tested the original version on few WordPress installations and all seemed fine, unfortunately, my sample size was too small and others have run into problems.

I managed to identify three major issues that contributed to failing backups.

Issue 1: Memory

Zipping large files in PHP can be quite memory intensive and the method I originally used read an entire file into memory before compressing it and adding it to the archive. So if your website contained a file that was approximately 50% the size of your PHP memory limit setting then the process would raise a fatal error. In version 0.7.2 I added a quick hack that increases this limit via the ini_set() function. Unfortunately modifying this setting is blocked when PHP is running in safe mode or the Suhosin Patch has been applied. The former of which is very common on shared hosts around the world.

The same issue applies when uploading a file to Dropbox which is bad considering that a websites archive can easily be quite large!

In this new version I have removed zipping altogether in favor of a smarter differential backup algorithm. Each file will now be uploaded individually if does not exist in Dropbox, or has changed on your sever since the last backup.  Of course, this will mean that your initial backup will be larger then that of a zipped archive, however all subsequent backups will only contain files that have changed thus decreasing bandwidth.

In addition I have added a warning system where, instead of failing, the algorithm will log a warning if an upload of a file fails. Currently a warning is raised if it encounters a file that will exceed the memory limit setting in PHP, the upload times out or there is an error connecting to the Dropbox server.

Issue 2: Safe Mode

A backup can take a very long time to complete so the plugin needs to set PHP’s max execution time to unlimited to get the job done. If your server has PHP compiled with safe mode enabled then there is no way this can be set in code. For more information please read the blog post I wrote about this problem.

If you are in this situation the plugin will now warn you that you need to manually set you max execution time to a larger value and  attempt to backup your WordPress installation. If the backup duration nears this setting then the backup will fail alerting you to the fact that it is has been set too low.

Issue 3: Your Host

The third major issue I encountered is the fact that some hosts, including my own, kill long running processes. So regardless of the setting you have set above if the process takes longer then the host allows it will be killed. To get around this I have introduced cron job to the plugin that will monitor the backup process to ensure it is still running. If the monitor notices that no activity has occurred in five minutes then a new backup process will be started resuming from where the last one failed.

Conclusion

In addition to these major fixes I have added validation of the paths and fixed a couple smaller issues to increase the stability of the plugin.

I hope this version will work for all, however there is no such thing as bug free code! So if you have any issues, rather then just giving the plugin a low rating or tagging it as broken, please let me know and I will endeavor to fix them.

Issues can be raised in the BitBucket issue tracker or the WordPress forum for my plugin.

 
  1. The Best Free WordPress Backup Plugin I’ve Found — Ikiru Design

    September 27, 2015 at 6:52 am

    [...] working without error are 600 and 128M.) My defaults seems a bit anomalous, and Mikey D has also made great strides in minimizing these problems by changing the way the plugin works, so it’s entirely possible [...]

     
  2. Stijn

    July 21, 2015 at 5:10 pm

    Hi Mikey,

    First of all, thank you for all the great work you did.
    We are in love with your backup plugin to dropbox.

    I’ve one question:
    Where can I set up ‘Backups to keep’ ?

    In the post of Sarah I see in settings that settings, but I don’t have the setting in my installation. I use the latest version 0.8.

    http://wpmu.org/how-to-automatically-backup-your-wordpress-site-to-dropbox/

    Thank you in advance!

    Stijn

     
    • Mikey

      July 22, 2015 at 4:38 pm

      Gday Stjin,

      Thanks for your feedback! The backups the keep option was removed in 0.8 because it was redundant for the new differential backup process. In addition Dropbox has a similar feature built in! Older versions of any file can be retrieved for up to 30 days.

      Cheers,
      Mikey

       
  3. Jerry Who

    July 20, 2015 at 9:35 pm

    I can’t find the svn-tag here: http://svn.wp-plugins.org/wordpress-backup-to-dropbox/tags/

    Will you and a svn-tag or do I have to use trunk (which I wouldn’t prefer)?

     
    • Mikey

      July 20, 2015 at 9:48 pm

      Gday Jerry,

      Trunk is 0.8 at the moment. I wil tag it just before I commit my 0.9 changes from my BitBucket mercurial account.

      I dont use SVN because DVCS is so much nicer to work with! :-)

      Cheers,
      Mikey

       
  4. Arpit Shah

    June 21, 2015 at 1:42 pm

    Hi Mikey, really great work. It works like a charm. 5/5 star :)

     
  5. WordPress Website Maintenance | DIY Website

    June 11, 2015 at 6:49 am

    [...] to dropbox. Currently it’s still not absolutely stable for large websites, and like EZPZ has issues with Windows servers, but unlike EZPZ is trying to resolve [...]

     
  6. Jordi

    June 7, 2015 at 3:37 am

    just wanted to thank you for the plugin. i installed it today and it works great!

     
  7. ptp

    June 3, 2015 at 2:51 am

    Hi

    Is the sql database being backuped? I just made my first backup with 0.8 (worked flawless ;-) but could not find the database.

    Thx for your great work!

     
    • Mikey

      June 3, 2015 at 9:19 am

      Gday ptp,

      Yes the database into a file named ‘[database name]-backup.sql’ inside the local backup location you have set. By default this will be ‘WordPressBackups/wp-content/backups’ in your Dropbox.

      Regards,
      Mikey

       
  8. gearu

    June 2, 2015 at 9:12 am

    Sorry for all the comments:
    I am also now getting an error for my backup path

    “Invalid directory path. Path must only contain alphanumeric characters and the forward slash (‘/’) to separate directories.”

    the path I am using is:

    WEB_DESIGN/AUTOMATIC_BACKUPS/projectXYZ

    I can only assume it doesn’t like the underscores?

     
  9. gearu

    June 2, 2015 at 9:05 am

    the updates sound great. one question i have, which is not fully addressed above, is that the plugin is now doing a smart backup to dropbox, only copying files that have changed. does this mean that there is only ever ‘one’ backup, or can i still have a backup that runs once a week and keep the last 5 weeks of backups?

     
    • Mikey

      June 2, 2015 at 9:21 am

      Gday Gearu,

      Dropbox has this functionality built in! It stores the previous revisions of your files for 30 days.
      So if you need to revert back to an older backed up file you can find it in Dropbox online interface, click the right hand down arrow and then click previous versions.
      I plan on blogging about this soon!

      Cheers,
      Mikey