Updated software is the key to secure and reliable work space. Developers often publish updates and bug fixes for their software and the users must manualy update (haven’t seen an automatic updater for web applications yet).
I use Wordpress as a CMS for several web pages, so when new version is published, i have to manualy update them all.
I could save some time by installing software with SVN and then just update, but I didn’t. So the goal of this article is to import Wordpress SVN repository to an existing Wordpress path and then daily update all copy’s from the www, automaticly.
First, we have to import the SVN repository of Wordpress files into the existing path. I guess you could use some other way to do this, but mine works quite fine.
Let me just add, that you need to have SVN installed, i use Linux OS, you might use some other platform as well (commands are alike).
First, we create a file, in the ./ path of the Wordpress, named updated:
touch updated
.. and chmod it to 777:
chmod 777 updated
We open it in our favourite editor and copy/paste this lines in ..
#!/bin/sh
svn co http://svn.automattic.com/wordpress/trunk/ svnblog
cp -r ./svnblog/.svn ./
cp -r ./svnblog/* ./
rm -r ./svnblog
Second line commit’s fresh copy of Wordpress from WP SVN repository and save’s it in the path named svnblog. Then it copy’s files and SVN repository to the existing WP path (don’t worry, the existing confing.php, tamplates, etc. won’t be deleted). The last line just removes the temporary path svnblog.
If there was a new version of WP released (for example from 2.3.3 to 2.5), then you should visit you’re blog administration (http://webaddress/wp-admin) and just click upgrade (often there is a DB update and this is the only way to make it happen).
Ok, we have imported Wordpress SVN repository into our existing path. From now on, if we want to update Wordpress copy, we just write the following command ..
svn update
.. in the ./ path of Wordpress copy. The updating process is “update only“, so don’t worry - you won’t loose images, templates, plugins, ..
But our goal was automatic daily updating - the next step requires crond installed and running. Just add the bottom line in the daily cron ..
svn update /path/to/wordpress > /dev/null
Now every day system will check for Wordpress updates on the Web SVN Repository and update you’re copy, so you’ll always have a fresh one.
