Refinement of PHP Bitbucket Deployment Script from http://jamescollings.co.uk/blog/bitbucket-deployment-script/