Update your Wordpress installation via Ant
After toying a little with Ant I came up with this task
-
<project name="update_wordpress" basedir="../" default="all">
-
-
-
<target name="init">
-
<property name="ftp_user" value="john_doe" />
-
<property name="ftp_pass" value="secret" />
-
<property name="ftp_server" value="www.foo.com" />
-
<property name="ftp_path" value="ftp/path/to/your/blog" />
-
</target>
-
-
-
<target name="download_latest">
-
<mkdir dir="tmp" />
-
<get src="http://counter.wordpress-deutschland.org/dlcount.php?id=static&url=/de-edition/latest.zip" dest="tmp/latest.zip" />
-
<unzip src="tmp/latest.zip" dest="tmp" />
-
<delete file="tmp/latest.zip" />
-
<fail message="there's something wrong with the wordpress archive">
-
<condition>
-
<not>
-
<available file="tmp/wordpress" property="wordpressinstall.exists" />
-
</not>
-
</condition>
-
</fail>
-
</target>
-
-
-
<target name="backup" depends="init">
-
<mkdir dir="backup" />
-
<ftp action="recv"
-
server="${ftp_server}"
-
userid="${ftp_user}"
-
password="${ftp_pass}"
-
remotedir="${ftp_path}"
-
passive="yes"
-
verbose="yes">
-
<fileset dir="backup">
-
<include name="**" />
-
</fileset>
-
</ftp>
-
</target>
-
-
-
<target name="update" depends="init,download_latest">
-
<ftp action="del"
-
server="${ftp_server}"
-
userid="${ftp_user}"
-
remotedir="${ftp_path}"
-
passive="yes"
-
verbose="yes"
-
password="${ftp_pass}">
-
<fileset>
-
<include name="**" />
-
<exclude name=".htaccess" />
-
<exclude name="wp-content" />
-
<exclude name="wp-content/**" />
-
<exclude name="wp-config.php" />
-
</fileset>
-
</ftp>
-
-
<ftp server="${ftp_server}"
-
remotedir="${ftp_path}"
-
userid="${ftp_user}"
-
password="${ftp_pass}"
-
passive="yes"
-
verbose="yes"
-
binary="yes">
-
<fileset dir="tmp/wordpress">
-
<include name="**" />
-
<exclude name="wp-content" />
-
<exclude name="wp-content/**" />
-
<exclude name="*.html" />
-
<exclude name="*.txt" />
-
<exclude name="wp-config-sample.php" />
-
</fileset>
-
</ftp>
-
</target>
-
-
-
<target name="all" depends="init,download_latest,backup,update">
-
<deltree dir="tmp" />
-
<echo message="Update finished." />
-
</target>
-
-
</project>
Be careful, this Ant file downloads the german version of Wordpress. You also need to have commons-net and jakarta-oro in your %ANT_HOME%/lib installed in order to have this work. See here. Additional I won't be responsible if you screw up your blog or other relevant data. Be sure to make an manual backup first.