Below is my current WordPress update script. First this script downloads the most recent version and determines which version it is:
cd ~/src/ rm -f ~/src/latest.tar.gz rm -rf ~/src/wordpress/ wget -q http://wordpress.org/latest.tar.gz tar -xzf latest.tar.gz CURRENTVERSION=$(grep "wp_version =" wordpress/wp-includes/version.php | cut -f 3 -d " " | sed "s/;//" | sed "s/'//g") echo "Latest Version: $CURRENTVERSION"
Next it looks for all wp-config.php files in all the websites to identify which sites have WordPress installed. Then and finds the version from the versions.php script. If the version is not equal to the most recent downloaded version (from the code above), it copies the updated source to the website:
for installpath in $(find /webdir -name wp-config.php) do BASEDIR=$(dirname $installpath) INSTALLEDVERSION=$(grep "wp_version =" $BASEDIR/wp-includes/version.php | cut -f 3 -d " " | sed "s/;//" | sed "s/'//g") if [ ! $CURRENTVERSION == $INSTALLEDVERSION ]; then echo "updating" $BASEDIR from $INSTALLEDVERSION "to" $CURRENTVERSION cp -R ~/src/wordpress/* $BASEDIR/ else echo $BASEDIR "is already" $CURRENTVERSION fi done
Comments are closed.