Posts

Branwood Preparatory School were in the common situation of not having a consistent set of brand assets. They did have a logo and a broadly defined colour scheme which were in use throughout the school and in its marketing literature, but a number of significant variations had crept in over the years. They asked me to produce a single, consistent set of documents that would serve as a central point of reference for everything they produced.

The result was a simple style guide that struck a balance between consistency and flexibility, defining the master logo design together with a set of font and colour specifications. All this information was presented in a variety of formats (Illustrator, PDF and JPEG) laid out in such a way as to give an indication of the look and feel that should be employed in future products.

As a follow up to this work they also asked me to produce a print ad for publication in a local directory. It’s easy to see how the look and feel of the style guide has been carried through to a specific publication.

Branwood Preparatory School wanted a new look for their web site. The traditional school colours of burgundy and gold set a strongly contrasting colour scheme but the brief was for a contemporary and airy feel for the web site.

A strong and prominent logo combined with a striking and subtly shadowed display font maintained the gravitas and seriousness of the school’s brand and their approach to education. Luxury and modernity were achieved through generous use of white space, simple and delicate layout hinting, and an easy on the eye sans-serif body font.

The back-end was hosted in a WordPress environment with a number of plug-ins for media, calendaring, dynamic mapping etc. Content management and display was handled through careful design of the categories hierarchy together with some custom PHP coding.

Many hosting services allow their customers to administer their web sites using a product called cPanel. One of the features of cPanel is the ability to backup your hosting data, including your databases, email setup and code. Of course, most hosting providers also perform backups for you so you might wonder why you should bother about doing your own as well. But what if the hosting company folds or what if you want to move your site to another hosting provider?

The cPanel backup facility lets you do this manually but it’s also possible to spoof the web form it uses and drive the cPanel engine using a PHP script. That allows you to automate the backup of multiple web sites to an FTP server somewhere and have it run automatically as part of a cron job on a regular basis. Windows devs can get the benefits of cron using Windows Task Scheduler or the excellent pycron by Gerhard Kalab.

The Code

Here’s the script I use to do this. It’s based on work initially done by Justin Cook back in 2006 but cPanel has changed a bit since then and I’ve had to tweak it a little to accommodate these changes. I’ve also dropped in a simple loop through an array to backup multiple sites.

Personally I call this using the PHP CLI in my mobile USB stick XAMPP installation from my crontab and it backs up to the FTP server on my USB stick. Having said that, there are plenty of ways you can use this script and picking the best one really does depend on how you work and what your general development setup is.

Pitfalls and Their Solutions

A few things are worth noting if you’re trying to set this up yourself. There are two top tips for diagnosing problems with this setup:

Set $debug=1 in the script so you can see what errors you’re getting if any.

Check the incoming connections log on your FTP server to make sure the FTP data is getting through.

More specifically, if you look at the FTP server log and don’t see the connections coming in from the script then make sure your firewall/router is letting the traffic through on the right ports. The ports for FTP are 20 and 21 for the FTP protocol traffic itself and various other ports used for the payload data. Those ports depend on how you have your FTP server setup (see the discussion of passive mode FTP below).

The other potential pitfall with completely missing FTP connections is that you might be running a NAT router and yet not have setup port forwarding for the inbound FTP traffic in order to route it to the IP address of the FTP server itself.

If you’re using passive mode FTP (you probably should be) and you’re seeing connections in the FTP server log but they’re failing after the protocol negotiation with errors like 425 Can't open data connection. then make sure you’ve allowed the incoming data ports through your firewall as well as just the FTP protocol ports of 20 and 21. Setting up the passive mode FTP server settings lets you do this as well as set up the correct external IP address. There’s a great article on how all this works in general at FileZilla.