Backing up blocks


#1

I took a closer look at the auto backup script within Pulse the other day and realised that it wasn’t backing up the blocks in the site. :fearful:

After a little tinkering I added support for blocks as well as plug-ins. I also added in an additional block of code to automatically email the latest zip archive to me every time one gets created.

Now I can keep copies of my Pulse site content locally without having to remember to download the zip files. :grin:

Here’s the updated PHP file.

Please add backup support for blocks (at the very least) into Pulse.


#2

Wow, thanks @TimPlumb.
This is a very nice solution, especially emailing it to me is a nice feature.


#3

Wow good find @TimPlumb

The backup should be backing up the whole content folder - but nice spot and great addition :slight_smile:


#4

I’m glad you like the changes.

The oddest thing was that the original code didn’t specifically close the newly created zip files. It meant that the file wasn’t available for anything (emailing included) until the code had timed out and the server had stepped in to close the file.

I’d initially thought that the file may have been left open for a reason but it now looks like it may just have been an oversight in the original code.


#5

Okay, I tried it, works great! I received an E-Mail with everything inside. :slight_smile:

The next evolution could be a cloud backup (Dropbox, Gdrive OneDrive etc.) for larger sites. :wink:
I think of an backup that is to large for mail, maybe bigger than 25 MB? GMail would say No.


#6

I’ve an old script somewhere that I used to backup server files to Dropbox. This was before they introduced their API and now that script wouldn’t work.

When I’ve time I’ll look at using the Dropbox API but I suspect the user would need to create a unique key from their dev site. It is a little more involved than just dropping the files into Pulse but I agree that it would be good to have a seamless backup to Dropbox - especially for larger sites.


#7

I like your work Tim.

Which Pulse version does have this missing Blocks problem ? I have checked several Pulse versions (including version 4.5.2 the latest ?) and I could not find an incorrect backup with missing Blocks. When and why was the backup of the Blocks changed ?

I have implemented some extra improvements to Tim’s auto-backup.php script :

  1. The sorting of the backup files is incorrect due to the 12 hour time format and the missing preceding number for the hours in the timestamp. I changed it into a 24 hour notation and changed the filename format in military date-time notation yyyy.mm.dd-hhmm.

changed line 35 into :
$today = date(“Y.m.d-Hi”); // date(“m.d.y-gi”);
this results in proper file sorting

  1. I added the date(“Y.m.d-Hi”) function also to the email subject. That way you can avoid message chaining by Gmail.

  2. Saving to the cloud : I use Sendtodropbox.com to deliver the zip-file into my Dropbox.

To restore a Pulse website more easily I like to add in future to the backup procedure also the complete template folder and files like :
.htaccess
config.php
robots.txt
index.php
config.php
favicon.ico
sitemap.xml
(modified) language files


#8

Great work @boisdejardin - I like your amends :slight_smile:


#9

Thanks for the update @boisdejardin there are some great improvements in there. Using Sendtodropbox.com is a pretty neat way of backing these files up and doesn’t require the user to directly use the Dropbox API.

Now we just need to look at the return journey and see if we can curl into Pulse from Dropbox to restore the files! :slight_smile:


#10

Fixed in 5.0.2! :smiley::+1:
http://help.pulsecms.com/article/10-version-history

Email offsite backups included!


closed #11