Thursday 14 August 2008 3:39:52 pm
Hi guys, we do this with our current Plone based website using a clunky extension to do it. However, we're moving to eZ Publish and the native method of static content export seems to be geared towards a live, public CMS but a predefined cache setup for those pages that aren't updated frequently enough to warrant the overhead of the PHP engine and eZ template compilation (I could be wrong though). Regardless, this was one of the "Must Have's" when I was looking at candidate CMS's so I simply spent an hour or two honing a simple bash script which statically exports the entire site. The only addition I'd make to the script (and I will when I'm done configuring eZ for our needs) would be to clear the siteaccess cache before deployment to ensure the latest-content of our Custom Tags appears in each page they're included in. But that's just a matter of adding this to the script:
php bin/php/ezcache.php -s siteaccess
If you're interested, here is the small bash script I wrote:
#!/bin/bash
#ez-deploy.sh: A shell script to deploy an eZ Publish website.
# Russ Michell, May 1, 2008
# The URL to fetch:
URL=$1
# The dir to pile everything into locally
DIR=$2
# An array of dirs to exclude:
EXC[0]=ezpublish/index.php/eng/Community
EXC[1]=ezpublish/index.php/eng/user
# Build a list of dirs to exclude:
for exclusion in "${EXC[@]}"
do
LIST+="$exclusion,"
done
# Remove the last comma: (Operator "%%" means "delete FROM the RIGHT, to the LAST case of what follows.")
LIST=${LIST%,*}
# The command:
CMD="wget -mErp"
CMD="$CMD -nH"
CMD="$CMD --convert-links"
CMD="$CMD --cut-dirs=2"
CMD="$CMD -P$DIR"
CMD="$CMD --exclude-directories=$LIST"
CMD="$CMD $URL"
# Execute
$CMD
Ensure you set it to be executable and invoke it from the command line or add it to a custom script or even an extension/template/whatever:
#> ./ez-deploy.sh http://my-ez-site.co.nz/ /var/deploy/ezpublish-static/
Obviously, you'd then just use rsync or whatever to transfer your local static site-copy to the remote, public server(s).
Cheers, Russ
Russell Michell, Wellington, New Zealand.
We're building! http://www.theruss.com/blog/
I'm on Twitter: http://twitter.com/therussdotcom
Believe nothing, consider everything.
|