Finding diffs between clean and modified versions of WordPress

We have an issue where our developers try to update the core WordPress files. I wanted to find a way to keep them honest. here is my script:


# get WordPress
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 =" ~/src/wordpress/wp-includes/version.php | cut -f 3 -d " " | sed "s/;//" | sed "s/'//g")
# find WordPress installs and compare
for installpath in $(find $SEARCHPATH -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 "====Comparing $BASEDIR to Source====" 
		diff -rq --exclude="wp-content" ~/src/wordpress  $BASEDIR #| grep differ
		fi
done

,

One Response to Finding diffs between clean and modified versions of WordPress

  1. Matthew August 8, 2011 at 11:13 pm #

    hah! you’re doing exactly what I was doing for the longest time

    I’ve got one word for you, friend…

    Git.

    I’ve developed a method that works with any archive-distributed software like wordpress. You can even safely make and track your own modifications.

    Just import a wordpress tarball, branch by version, and make a “mods” branch (I call it “dev”), and then rebase your mods on top of new, incoming wordpress releases.

    The companion to this method is a push script. Basically a wrapper around rsync that pushes the right file. I’ve developed mine to the point where it tells me all files being updated, deleted files, new files, and files with actual content changes.

    Oh yeah, with Git you get the diffs you’re looking for along with a tonne of other great features.

    Get the rpmforge repo to access git.

    good luck