I've attached four files. They will need a tweak or two out of the box to run with your setup. Specifically, change the site name in xf-check(in|out) and xf-list to your site, with the correct path to admindav.php. You'll want to change the default style number in those same files to be the style you want to edit by default (mine is #2). Otherwise you can override it with the environment variable TEMPLATE (note this is really more "style", but I meant it as an overall template-library ID). You'll need the cadaver package installed (command line webdav client) and a .netrc file setup per cadaver's man page, and to have followed the XF instructions to enable WebDav.
xf-checkout template1 template2 ...
Give it one or more template names and it will download them from your xen installation, using the given style ID (see above paragraph), and leave them in the corresponding filenames in the local directory.
Will check in "template1" to your xen install, using the style number specified in the prior paragraph
lists all templates/css's in the specified style
You'll need to edit this to specify the list of style ID's you want it to dump. For each style ID listed (i), it will create subdirectory i from the current directory, and that subdir will contain files for all the templates/css's. Note that this gets everything, and is somewhat overkill if you're just dealing one or two templates. But, it's very handy to have versions of all the templates on disk to locate what you're looking for. Just make sure to always check out a new version before editing it, in case you've made a later change via acp.
So... typically when I do changes, if I know the template name, I just do
xf-checkout PAGE_CONTAINER (or appropriate template name)
If you run export TEMPLATE=4 before this, it'll default to style 4.
If I want to tell how my version of PAGE_CONTAINER differs from the base/default one. First I run xf-diff. It creates a library of all the versions of everything. Next I run
diff 0/PAGE_CONTAINER 2/PAGE_CONTAINER
(you can use sdiff or the diff of your choice)
So when faced with obsolete templates after an upgrade, you can do this:
First, run xf-diff to create a library of the current/old versions of the templates. Ideally do this before the upgrade. Make sure you have directories for style 0 (base) and the ID of your default style (in my case 2).
Now, when you have the list of obsolete templates from the xf acp, for each of them, run the diff command as listed above. This will tell you the exact changes you made from the base version. Next, revert the template in acp. Then use the xf-checkout-edit-xf-checkin flow to apply the diffs (I do it manually) to the now-reverted template.
This method pretty much ensures you won't miss any changes you've made since by diffing 0 vs. your default style over the full dump of all old template files from each style, you get all the changes listed out.
#!/bin/sh if [ -z "$TEMPLATE" ]; then TEMPLATE=2 fi ( echo cd Public_Templates echo cd $TEMPLATE echo ls ) | cadaver http://thunderbeastarms.com/forum/admindav.php | \ grep -v '^dav:' | grep -v 'Listing' | grep -v 'Connection to' | \ sed 's/^Error:\s*//g' | cut -d' ' -f1
#!/bin/sh #for a in 0 1 2 3; do for a in 0 1 2 3 4 5; do export TEMPLATE=$a mkdir $a || true ( cd $a export TEMPLATE=$a list=`xf-list |sed 's/\.html//' ` xf-checkout $list ) done
#!/bin/sh if [ -z "$TEMPLATE" ]; then TEMPLATE=2 fi ( echo cd Public_Templates echo cd $TEMPLATE until [ -z "$1" ] # Until all parameters used up . . . do echo get $1 shift done ) | cadaver http://thunderbeastarms.com/forum/admindav.php
#!/bin/sh if [ -z "$TEMPLATE" ]; then TEMPLATE=2 fi ( echo cd Public_Templates echo cd $TEMPLATE echo put $1 ) | cadaver http://thunderbeastarms.com/forum/admindav.php
PS- It would be helpful if we could upload .tar.gz files. Standard packaging for unix systems.
1.2 KB Views: 3