Skip navigation

BackuPing

I hope everyone using WordPress know that it ships with a backup plugin. It’s a great beginner solution that makes people aware that they should care about making backups of their data. But to me it didn’t make the cut a while ago when I really started to care about safe backup of my data. Part of the story is the fact I’ve got two blogs, this one and one in swedish, in addition to some other stuff in a hosted database they all share.

The standard backup plugin can do most of the things I want, but not all and with way to much labor than necessary. What I wanted was to back it up all at once, the whole database, get it stored securely and have it as automatic as possible.

One great solution I found was to install phpMyBackupPro, set up a GMail account for the backups to be sent to and create a ping’able backup script.

It is really simple to install phpMyBackupPro by following the instructions and you’ve got your first backup in five minutes or less. After confirming that making backups do work, that backups get sent to your email account, just click on the “Schedule Backup” tab in the interface and generate a custom PHP script for your intervall of choice. I set mine to 1 hour and put the file, that I named backup.php, in the same directory as phpMyBackupPro.

But the generated backup.php script will not run unless someone visits that particular URL, the idea proposed by phpMyBackupPro is to include the file in commonly visited pages. Now, given that I only want it to be run when I’ve actually changed something, there is a much smarter way to deal with it. I’m guessing that you just like me are at least pinging Technorati or other similar services, so I decided to treat the backup just like pinging yet another update service.

In the same directory as the phpMyBackupPro installation I put the following into a file called ping.php:


 <?xml version="1.0"?>
 <?php @include(’backup.php’); ?>
 <methodResponse>
  
   <params>
     <param>
       <value>
         <struct>
           <member>
             <name>flerror</name>
             <value>
               <boolean>0</boolean>
             </value>
           </member>
           <member>
             <name>message</name>
             <value>Thanks for the ping.</value>
           </member>
         </struct>
 
       </value>
     </param>
   </params>
 
 </methodResponse>

All it do is including and running the generated backup.php script and make the pinging client happy by reply a success message.

Next, open the WordPress Admin interface and go to Options > Writing and add the URL of the ping.php script, for example http://example.com/backup/ping.php, to the Update Services. Your backup script will now be pinged together with all the other services.

In my case it means that whenever I’m saving posts the script gets pinged and if no backup has been made in the last hour a new one is made and sent to my GMail accout. The brilliant thing is that datasets, even large ones, get compressed really well before being mailed and that GMail let you store over 2GB of email securely! So there are no reason not to store at least one month worth of backups.

Post a comment

Your email is never published nor shared. Required fields are marked *
*
*
Creeper